How download Google Drive file with a GAS web app?

133 views
Skip to first unread message

themacboy

unread,
Sep 6, 2024, 4:36:40 AM9/6/24
to Google Apps Script Community
hi,

for the past few days I was trying to figure out how to successfully download files from Google Drive using a simple GAS web application, but all my attempts have failed.

  I made a GAS web app that reads a folder in my Google Worspaces Drive and displays a list of all the files in a simple HTML GAS web app, then you can click on any file to get its id and download it.

I tried with Google Drive Api rest v.3 but I can't work with API_KEY. Then I tried with OAuth2, but im not sure how to manage it, later the Iframe and Cors illed me…

Someone please show me the correct way to do this with the GAS web app in Google Workspaces.

Thanks in advance!

fl

unread,
Sep 6, 2024, 6:35:21 AM9/6/24
to Google Apps Script Community
Try using the 'export' in the URL:

https://docs.google.com/presentation/d/<doc_id>/export?format=png&exportFormat=png&pageid=id.g28494d67801_0_10

fl

unread,
Sep 6, 2024, 6:48:52 AM9/6/24
to Google Apps Script Community

themacboy

unread,
Sep 9, 2024, 2:43:13 AM9/9/24
to Google Apps Script Community
Not that esasy ...

expot is used to convert Google drive native file, but Im not talking about native files, Im using any type of file.

All other URL in my job Google Workspaces return a missing file error, due Drive Rest API not support the use of API_KEY credential.

When using getDownloadURL() it return a empty string and when I use the  webContentLink that parameter not exists on the file metadata.

Not sure what more to do.

El dia divendres, 6 de setembre del 2024 a les 12:48:52 UTC+2, fl va escriure:
Reply all
Reply to author
Forward
0 new messages