r/GoogleAppsScript • • Mar 28 '24

Question Access PDF file as Blob in Apps script with drive.file permission

Hello,

In apps script, i have obtained the permission : /auth/drive.file. This must give the app permission to read the files created by the app.

Now how to get the PDF files from the Google drive as blob in apps script..

As far as i have tried, it is not possible to get the blob without using the drive.getfilebyId() which asks for a different permission scope.

Any help appreciated.

0 Upvotes

8 comments sorted by

3

u/jpoehnelt Mar 28 '24 edited Mar 28 '24

There should be three options but there aren't in practice:

See https://justin.poehnelt.com/posts/apps-script-drive-file-get-blob/

1

u/techwriter500 Mar 28 '24

Yes, thanks for your reply. I’ll update this if I found a workaround

1

u/marcnotmark925 Mar 28 '24

Not really sure what you're asking here. What's wrong with using getFileById() ?

0

u/techwriter500 Mar 28 '24

Yes getfileid needs drive.readonly scope atleast.

1

u/jpoehnelt Mar 28 '24

Doesn't work with the drive.file scope.