File search in csv in uipath - csv

I'm trying to figure out a way to search in a google csv (list of names) if a name is present.
Is it possible in uipath?
According to my research, it may fall into the web recorder and the use the module to read csv?
Here is what I tried again:
In the main screen, I created a sequence.
Open a browser to a url like this
"https://docs.google.com/spreadsheets/d/xyzz/edit#gid=0"
Added a "Navigate to" the above URL again.
Then selected "Data Scraping".
Click on the first row of google sheet.
Then to create a pattern I clicked on next row. It couldn't find a pattern.
So I'm stuck on the final 6th position. I tried downloading and working on the csv as an alternative. But I would rather want it on the google sheet in the browser.
Am I going in the right direction?

Another way is:
to download Google GSuite set of activities from Google GSuite.
Place it under Packages folder in your UiPath installation folder and load it via Manage Packages option in Design Mode.
Use GSuite Application Scope (you need to fill your ClientID and ClientSecret for your account)
Use activity Find Files and Folders to search for the file that you want by name. You will get the file ID (in your case the SpreadSheetID) as output
Use a Read Range activity placing the output from step 3 to get the contents of spreadsheet as DataTable
Use your pattern to search through DataTable for the desired result.
Activities are shown as per below (Highlighted are the ones to use)-(Notification on the second Image is due to the fact that ClientID and ClientSecret are mandatory and i left them empty):
Hope you will find these information useful

Related

Discrepancy between Drive Search and DriveApp.searchFiles(target)

Posting this here because I have found no note or solution elsewhere on the web.
I am currently experiencing a discrepancy between search results when using the drive search toolbar and the DriveApp.searchFiles() functionality of apps scripts as follows.
The drive search bar always returns complete results for a given query [looking at all text within a document and in the title], but DriveApp.searchFiles() does not. Certain files are missing/not returned.
Upon finding a given file that is returned from the drive search bar ONLY (one that was not being returned by the DriveApp search) and opening it, it then starts appearing/being returned by DriveApp.searchFiles().
This issue further seems to be a user-specific one. The script we are developing is used by multiple users and new users (ones that are added to an extant file system and then given our tool) experience this issue for a majority of files. After which, when they open a given 'missing' file, it begins appearing in the search results once more.
For reference, my code is as follows:
var targetParam = 'title contains "'+target+'" or fullText contains "'+target+'"';
var searchResults = DriveApp.searchFiles(targetParam);
In all instances of this issue, the drive search bar returns a complete list and opening a given file 'fixes' its issue. Given the scale of what we are trying to do it is not a possibility to have every user open every file.
For clarification, these files are within a large file system in either team drives or traditional G suite. Users are given access by being added to the highest level file, to the team drive, or by being added to a user group that has access to the file system already. All users are within our domain.
Is this a known discrepancy? Is there something that I may be doing wrong in my search query to cause this? I am interested in any potential solutions or ideas.
Just to mention one of the things that are causing this, from Use Groups to share content (emphasis mine)
If you later add new members to the group, they'll be able to access the document only via the document's URL. To make the document appear in the Shared with Me view of a new member's Google Drive, you must reshare the document with the group or share the document with the new member individually.
A possible solution to this (I don't have a domain to test on) is to enable and then use the Drive "advanced service" and not the DriveApp implementation. If one reviews the Drive REST API for Files#list, one will note that the default corpus used when querying for files is files that the user has accessed. This corpus includes any file the user has created themselves (by UI or by script).
Thus, modifying the search corpora could be the answer. There's a lot of extra stuff that has to be added if you want to search Team Drive items, so I'll leave that to the reader.
function searchDomain(query) {
const listOptions = {
q: query,
corpora: 'domain',
};
const results = [];
do {
var search = Drive.Files.list(listOptions);
listOptions.pageToken = search.nextPageToken;
if (search.items)
Array.prototype.push.apply(results, search.items);
else
console.log({message: "No results for search", search: query, options: listOptions});
} while (listOptions.pageToken);
return results;
}
Given that you mention DriveApp.searchFiles you already know the general structure for the query string, but for anyone who is finding this, you will want to review the documentation on its format here

finding file in google drive based on id/interoperating previous developers code

So I hope the question makes sense. I am relatively new to GoogleAppScripts. I have a client that has some Scripts that I am trying to interoperate and modify. In order to do so I need to find each document that is associated by 'id'. But when I search for the id in the search bar of drive,I just get the script file that I am working on because the id number is in the text. I need to find the particular sheets doc that is associated with a particular ID, plain n simple. There has to be an easy way to do this aside from writing a function and outputting the result...
The search bar in Drive doesn't do search by ID, however if you know the ID you can hand-craft the file URL & access it that way — if you have permission to access the file in question. e.g. you could open a Drive file with a URL like https://docs.google.com/{file-type}/d/{file-ID}, where {file-type} is document, spreadsheet, etc, & {file-ID} is the ID you have in the code.
An alternative is to get the names of the files for which you have IDs, write the results to the log (i.e. Logger.log(DriveApp.getFileById("your_file_id").getName());) & then search for them by name in the Drive UI.

Sorting & Placing shared Google Drive documents into folders

Is there a script/extension available to automatically sort Google Drive documents that are shared via email and place them into a specified folder created in Google Drive. For example if John D shares the Morning Meeting Notes with me via email then I could automatically have that file saved into John D's folder in Google Drive.
You can get an idea from this post by StackExchange.
So here is the user's needed:
Would it be possible to
Send an automatic received receipt exclusively to emails that send time-sheet type image or PDF attachments.
Label the Gmail with 1 or 2 separate labels like "time-sheets" and "downloaded"( read next part )
send the attachment to a specific google drive folder.
You have exactly same scenario.
Here are the answers:
For 1.
You'll need to turn on the "Canned Responses" Gmail Lab. Create a
canned response with your response text ("Received").
Then, adjust or create a filter:
to:myEmail#gmail.com has:attachment .pdf
That should pick up any PDF file that's sent to you. (You could get a
false match if someone sends some other sort of attachment and puts
the string ".pdf" somewhere in their message.)
If you want to match on more file types, you can do something like
.png OR .jpg OR .gif OR .tiff OR .jpeg OR .tiff
For the action, choose "Send a canned response" and, obviously, choose
the canned response you created earlier.
For the 2nd question, here is the response:
In order to label a message via filter with two separate labels,
you'll need to have two separate filters. Just copy the criteria for
one filter to the other. (If you're ambitious, you can export your
filters, edit the resulting XML, then re-import them.)
And for the last:
You can easily do that with an IFTTT recipe. The Gmail channel lets
you trigger on a Gmail search and then you can use that to save to
Google Drive. Here's a recipe that's similar to what you'd want
to do.
To get sample scripts, here is a documentation for drive and gmail and for further reading as well.

Google DoubleClick - Dynamic creative - refreshing data

I have a Google DoubleClick account and I have linked it up to a google sheet.
The problem I am having is after updating the google sheet I dont see the copy updated in the advert.
I also don't know the difference between 'transformed content' and 'element' and if I need to transform after every change.
The doubleclick documentation is terrible.
In order to update the data in your feed here's what you can do:
Process:
*If your feed has already been published you will need to create a draft of the feed
see picture - create draft
Go To the Manage Data Step (#2) and you can Retransform your data source (this goes to your original source and refreshes the data)
see picture - retransform
Once the Retransform has occurred you can republish the feed if it's already been published or go back to testing if not.
If you're using Google Web Deisgner you will probably need to relink your Schema if any columns or fields have changed.
Why this is necessary:
When you set up a sheet and provide it to the dynamic feed DoubleClick copies the data in your sheet and caches it on their ad servers. If you change something in the sheet it will not be reflected on their servers until you Retransform the sheet.
You really shouldn't need to mess around in the Transformed Content and Element tabs as far as I have run into.
If you need to add columns or remove columns from your sheet be aware that you will have to remove the feed, save and then add it again as new content to get them to show up.
BE AWARE THAT REMOVING COLUMNS ON A PUBLISHED FEED WILL BREAK ADS THAT ARE ALREADY RUNNING - If you need to remove a column it's better to start a new feed IMO.

Replicate with Google Script the behaviour of "File" > "Download as..." in Google Spreadsheet

I'm looking for a way to either:
a) replace "File" > "Download as..." > "Microsoft Excel (.xlsx)" in Google Spreadsheet in such a way that when I click on "Microsoft Excel (.xlsx)" it asks me for the name of the file that I want to save (i.e.: like a typical "Save as..." menu entry).
b) if it's not possible to replace the standard menu entry, I would like at least to add another menu entry in another menu which behaves like described above.
Even though I haven't been able to write a script that lets me replace an existing menu entry, I've managed to write a script that adds an additional menu.
Is it possible to accomplish "a"?
Another problem now is that I can't seem to find a way to replicate the behaviour of "File" > "Download as..." > "Microsoft Excel (.xlsx)".
I've found other posts in which it's described how to write Google Scripts in order to do something similar (e.g.: create a backup of a spreadsheet in Google Drive in a specific format, or send it via GMail to a specific address).
Actually, after reading "Can I download file from URL link generated by google apps script" I'm not even sure it's possible.
Note that you cannot download per se, since you have no access to your
PC's resources (e.g. file system) from apps-script. The file is still
in "the cloud"... in this case, it's been copied from the web site it
was on, into Google Drive. If you're running the Drive app, though,
the file will now sync to your PC.
Is there any way to do that?
Thanks in advance.
The only way I achieved download of a file from the spreadsheet is by writing completely separate script which accessed my original spreadsheet by document id, generated a file and downloaded it like this:
function doGet(){
var outputDocument = DocumentApp.create('Some csv');
var content = getCsv();
var textContent = ContentService.createTextOutput(content);
textContent.setMimeType(ContentService.MimeType.CSV);
textContent.downloadAsFile("4NocniMaraton.csv");
return textContent;
}
Then I had to publish the App and get a link for it. That link I placed in one of the sheets in the original spreadsheet, which I used as a data download link. Other then this I didn't find a way to work the security issues around.