Answers for "google script save to a json data file"

0

google script save to a json data file

function saveAsJSON() {
  var blob,file,fileSets,obj;

  obj = {//Object literal for testing purposes
    key:"value"
  }

/**
 * Creates a file in the users Google Drive
 */

  fileSets = {
    title: 'AAA_Test.json',
    mimeType: 'application/json'
  };

  blob = Utilities.newBlob(JSON.stringify(obj), "application/vnd.google-apps.script+json");
  file = Drive.Files.insert(fileSets, blob);
  Logger.log('ID: %s, File size (bytes): %s, type: %s', file.id, file.fileSize, file.mimeType);

}
Posted by: Guest on July-16-2021

Code answers related to "google script save to a json data file"

Code answers related to "Javascript"

Browse Popular Code Answers by Language