showing results for - "save json data in google drive"
Tim
24 Sep 2017
1function saveAsJSON() {
2  var blob,file,fileSets,obj;
3
4  obj = {//Object literal for testing purposes
5    key:"value"
6  }
7
8/**
9 * Creates a file in the users Google Drive
10 */
11
12  fileSets = {
13    title: 'AAA_Test.json',
14    mimeType: 'application/json'
15  };
16
17  blob = Utilities.newBlob(JSON.stringify(obj), "application/vnd.google-apps.script+json");
18  file = Drive.Files.insert(fileSets, blob);
19  Logger.log('ID: %s, File size (bytes): %s, type: %s', file.id, file.fileSize, file.mimeType);
20
21}