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.
Related
I'm trying to do an automation by using the Google Apps Script, and I'm having some trouble. That's why I need it.
1 - The script must identify the subject of an email.
2 - If the subject has a specific word, the script downloads the attachment.
3 - But before it downloads the attachment, the script should read the subject of the email and look in Google Drive if there is a folder with the same name of the subject.
4 - If the folder already exists, the script just downloads the file to this folder in Google Drive.
5 - Else, the script creates a folder with the same name of the email subject and then downloads the attachment to this folder.
If you already have an attempt at this script, I'd recommend sharing it when posting a question and also pointing out the issues you are running into.
In any case, I'll share some documentation and ideas to help you achieve this.
Start by listing the messages you will be using for your automation. I'd recommend having a look at the Gmail API method users.messages.list. The response of this method should contain an array called messages which you can loop through for the next requirements.
From the list of messages returned, you can find the subject of a message by accessing the attribute message.payload.headers. headers is a "name/value" type of array, if you loop through its contents, one of the "names" should be "Subject". Now you can store the subject on a variable to work with it and determine if it meets your criteria. To download a message attachment, you can use the Gmail API method users.messages.attachments.get.
With the full subject retrieved in 2, you can search on a specific folder in Drive to see if a sub-folder with that name exists. To do that I'd recommend having a look at the Drive API method files.list and use the parameter q to enter the search criteria. Example, to search for a folder named SUBJECT_NAME_OF_FOLDER, located inside another folder with id PARENT_FOLDER_DRIVE_ID, my q parameter value would look similar to 'PARENT_FOLDER_DRIVE_ID' in parents and mimeType = 'application/vnd.google-apps.folder' and name = 'SUBJECT_NAME_OF_FOLDER'.
If a folder with your criteria is returned from 3, then you can retrieve that folder ID from the response array files[n].id. With this ID, you can call Drive API files.create, setting the mimeType according to the message attachment mimeType and the parent parameter will be the ID you found from the search in 3.
If your search hasn't returned results, then most likely the folder with that specific name (at least in the location specified) does not exist, then you can create a new folder by calling Drive API files.create making sure to set the mimeType parameter as application/vnd.google-apps.folder. After creating the folder you can store the newly created ID and repeat 4 using this ID.
Hope it helps. Cheers!
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
Looking to automate the processing of data in a spreadsheet generated by google forms; specifically, I want to attach the files uploaded to the form to outgoing emails as attachments. The files can be synced to a local folder for the program to access, but the google form only has a url for each uploaded file.
What would be the most efficient way to determine which of the files uploaded correspond with each form submission and its corresponding link?
Edit: my research indicates that I may be able to use an identifier from the url to see which document it is through an apps api. Another thought was to scrape the html from the linked webpage and then to glean the file name from somewhere in the html here it hopefully occurs with regularity.
Then I could use the filename to construct a filepath to the synced folder on my local machine or would it be better to use the drive api to manipulate the file into an email attachment?
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.
Is it possible to create a new document (either using a template or completely dynamic) using the Google Drive APIs? I am working with a client that requires generation of word documents. I tired looking up but I couldn't find sufficient documentation on how to "create and format" documents using the APIs.
For example, can I include the client's company logo on the top of the doc programmatically? I'd like whatever I am doing for this client to be generic (i.e including logo at the top etc) to be dynamic, so I can re-purpose this for other clients as well.
I also am having difficulty finding documentation on any kind of formatting we could do on the documents (bold, italic, new paragraph) etc
The Google Drive API only deals with whole file operations. It has no understanding of the content of the files, including formatting.
You have two options:-
Use Apps Script (ie. not the Drive API) which has document manipulation features. See https://developers.google.com/apps-script/reference/document/
Create your templates in HTML (or Word, OpenOffice), then upload them to a new file, setting the option to 'convert to google docs'
It is possible to create new documents as well as make a copy of already existing documents (templates)
Some time ago I've created simple example how to work with templates:
On your Google drive create folder Templates
Inside this folder create formated document with images, texts etc... Replace dynamic values with {A},{B},{C} representing spreadsheet column names in this document
Than create spreadsheet and fill some data in it. Inside this spreadsheet navigate to Tools->Script gallery and search for fast template generator -> Install it
Close document and re-open it. Script will automatically execute onOpen function which will add Template generator to spreadsheet menu. Now just choose row from which you would like to populate values in template and launch Template generator-> Generate from template.
A new document with filled values will be generated from chosen template.
You can find source code and customize it in according your need in Tools->Script editor in this spreadsheet, so result should be in PDF or sent via email etc...
EDIT: Seems this approach does not work, as Google Drive API only allows copying files across current user's Drive.
I found for me suitable approach was to create a document in my own Google Drive. Style it accordingly, add base text etc. and give it read-only permission to everyone. Then from the Google Drive API use copy file functionality and copy it into the current users Drive.