Oct 1, 2019
Upload a file to google sheets cell
How can I achieve this, I found this code but seems to be deprecated.
Informational notification.
This question is locked and replying has been disabled.
Community content may not be verified or up-to-date. Learn more.
Last edited Oct 1, 2019
May 16, 2020
This could have saved me a lot of coding and this solution gives you the drag and drop feature as well. But I learned a lot about google apps script during my project so it was still worth it.
DropSpread add-on Works really well once you figure out how to activate it. Took me a bit. It will probably do what most people want, which is attach a file to a cell.
If you want to control your code more and have it do more things then you can use the code I posted in a previous post. But this custom code is not for faint of heart.
Last edited May 16, 2020
Diamond Product Expert Matt:King recommended this
Helpful?Upvote Downvote
All Replies (46)
Oct 1, 2019
Can you please explain why you want to do this?
Could you not upload the PDF file to Drive and then put the link to it in your cell?
Apologies if I'm missing something obvious here.
Could you not upload the PDF file to Drive and then put the link to it in your cell?
Apologies if I'm missing something obvious here.
May 16, 2020
My code is on github here:
The main part of my learning was from here. This has a great youtube video you can watch.
And then took some snippets from Keith as well, who posted above. This gave me some additional code in the script that allows me to launch the form from within a drop down menu in sheets.
I had some problems when dealing with the form being called from inside google sheets drop down. The form would always return an error. I later figured out how to use the paragyte code and have the html form post to a hidden iframe. But using these 2 blogs helped me so so muc.
Then I had to figure out how to write a terrible little progress bar so you could see the file uploading sort of.
This is a total hack job but it does everything I want. I don't really need the email part but that is easy to comment out.
I will posted files on the github link above. This will give you the gist but you should still watch the paragyte video. I still have lots of work to do but after 2 days of struggling, glad to have something going that works. It shouldn't have been so hard.
I can start in google sheets, click the new attach menu and choose file and then fill out the form and attach my file and my results go into drive and the link from drive gets copied into my excel along with the other fields from the form that I may also want to put on that spredsheet row. Works great. It also sends me an email.
This was originally made as a form accepting resumes on the public web but that's not what I will be using it for. For me its to keep track of my receipts and vendor invoices.
You will need to make sure you deploy as web app and update all the code with your specific webapp link and also you will need to put in your own google sheets id for your sheet . It will connect to your default google drive account and create a folder called Demo for the uploads. It makes lots of subfolders too, you can edit this out so it doesn't make the individual subfolders. I'm just lazy right now, I'll edit that part later.
When you publish make sure you give access to "anyone, even anonymous". It will be pretty hard for people to find your specific link unless you give it to them.
Your unique code will look something like this when you publish the app.
its important that you use your unique id.
The video from paragyte.com explains all this.
https://www.paragyte.com/blog/upload-file-to-google-drive-and-insert-data-into-spreadsheet-using-google-apps-script
My code is on github here:
Here is a picture of the form and a picture of the attach drop down menu.
Oh yeah,
You need to put in the ID of your google sheet that you want it to write to in the code.gs. You don't have to hard code it but I hardcoded the sheet ID anyway just for debug.
It just uses the google drive associated with your account that you choose when you give it access.
It is best to run the app once from within the script editor even though it will fail. But at least it will give you the prompts you need to give permission to your google account.
Reply here if you need help.
Hope this is useful to someone. It will save me some steps when I upload receipts and invoices to my quarterly accounting spreadsheet for my small business.


Last edited May 16, 2020
This could have saved me a lot of coding and this solution gives you the drag and drop feature as well. But I learned a lot about google apps script during my project so it was still worth it.
DropSpread add-on Works really well once you figure out how to activate it. Took me a bit. It will probably do what most people want, which is attach a file to a cell.
If you want to control your code more and have it do more things then you can use the code I posted in a previous post. But this custom code is not for faint of heart.
Last edited May 16, 2020
Diamond Product Expert Matt:King recommended this
May 21, 2020
May 28, 2020
May 29, 2020
Jun 17, 2020
Jul 6, 2020
Drop Spread add on is not offered. Is there an alternative please?
How do I create a link to an email to a cell in Google Sheets?
And how do I add a file (pdf of my email) to a cell in Google Sheets.
Thanks much,
ny
5/16/20
Also I found a google sheets add on called DropSpread. Give it a try.
This could have saved me a lot of coding and this solution gives you the drag and drop feature as well. But I learned a lot about google apps script during my project so it was still worth it.
DropSpread add-on Works really well once you figure out how to activate it. Took me a bit. It will probably do what most people want, which is attach a file to a cell.
If you want to control your code more and have it do more things then you can use the code I posted in a previous post. But this custom code is not for faint of heart.
recommended this
Last edited 5/16/20
Helpful? 3
Jul 6, 2020
Save email as a pdf.
Save Email pdf in Google Drive
Open pdf in GDrive and press share icon
Copy link
paste link in cell in Google Sheets.
Jul 14, 2020
Drop spread is no longer available and I tried using all the code supplied. None of the code actually uploads anything unfortunately. I get to the success part and nothing happens.
Jul 20, 2020
Yep, that's exactly the process everyone is trying to avoid. What people want is:found a round-about for inserting email into a cell in Google Sheets:Save email as a pdf.Save Email pdf in Google DriveOpen pdf in GDrive and press share iconCopy linkpaste link in cell in Google Sheets.
1. Click in cell.
2. Click "Insert file/object as attachment".
3. Drag and drop file, or upload from local storage.
4. Done.
Aug 5, 2020
1. Upload the file to your drive, then right-click on the pdf and select "get shareable link".
2. Select the "anyone with the link" can access the document (although this is kind of sketchy for bills, I'd suggest sharing it with anyone who would open it and selecting that option for more security)
3. Copy the link and right-click the desired cell you want to file linked too and select "insert link" (or ctrl k)
4. Paste the link and it should show up as a hyperlink which will open up the file in a new browser tab
Google user
Aug 20, 2020