Download files from Google Cloud Storage

124 views
Skip to first unread message

waclav.petrak

unread,
May 4, 2019, 1:31:27 AM5/4/19
to google-apps-sc...@googlegroups.com

I'll get help.
Need to download files from Google Cloud Storage.
I need to save the files to Disc, or load the contents of file.txt

I managed to retrieve information.
But I need content.

function infoFileFromStorage() {
 
  var response = UrlFetchApp.fetch(url, {
    method: "POST",
    headers: {
      Authorization: 'Bearer ' + service.getAccessToken()
    },
    muteHttpExceptions: true,
  });

  Logger.log("response");
  Logger.log(response);
}

Thanks!

Venca

waclav.petrak

unread,
May 6, 2019, 3:16:48 AM5/6/19
to Google Apps Script Community
So now I know.
If it suits someone, this is how:

var  url = 'https://www.googleapis.com/storage/v1/b/' + bucketName + '/o/' + fileName + "?alt=media"

Venca


Dne sobota 4. května 2019 7:31:27 UTC+2 waclav.petrak napsal(a):

aj.addons

unread,
May 6, 2019, 7:32:19 AM5/6/19
to Google Apps Script Community
Thanks for sharing the solution.
Reply all
Reply to author
Forward
0 new messages