cancel
Showing results for 
Search instead for 
Did you mean: 

Downloading files stored in Google Drive

marenas
Contributor

Dear Community,

I have a use case wherein I need to download a file from Google Drive. I followed this guide and the authorization is working fine:

Connecting SaaS providers with SnapLogic's OAuth-enabled REST Snaps | SnapLogic

Then, I configure REST Get snap, add the Query parameter q = title contains ‘xyz’ and use https://www.googleapis.com/drive/v2/files/ in the service URL. The snap validates and returns the metadata of xyz file.

My question is, how to download the file? After reading this documentation, I added + $id + ‘?alt=media’ in the service URL but I got this error below: Rest GET

Can you suggest any solution? If I could not download the file, can you suggest any workaround where I can see the data so that I can write it as a .csv/.xls? Also, I noticed that the snap took longer to validate when I added these in the service URL.

Thanks in advance.

7 REPLIES 7

Yes, I also enabled the drive API access and authorize the Google account when I click authorize. see below snapshots:

drive API access

authorize google account

aleung
Contributor III

Were you able to make this work? If so, can you share what you learn?

Hi!

Apologize for the delayed response.

Yes, I was able to make this work.

First, set up a Google Service account (it is an AD account with a mailbox attached to it), other team helped us with this part.

Next, I created the Account in SnapLogic of type “Spreadsheet OAuth2 Account”
image

When you click, “Authorize”, you will be prompted to sign in using the Google Service account.

In Designer, I use the snap “Worksheet Reader” and use the account “Spreadsheet OAuth2 Account”. In the document/spreadsheet that you are going to read data from, please make sure to share that with your Google Service Account.

I hope this helps.