File size: 702 Bytes
5a32ee0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function getDriveService() {
  var service = OAuth2.createService('drive')
    .setAuthorizationBaseUrl('https://accounts.google.com')
    .setTokenUrl('https://accounts.google.com/o/oauth2/token')
    .setClientId('YOUR_CLIENT_ID')
    .setClientSecret('YOUR_CLIENT_SECRET')
    .setCallbackFunction('authCallback')
    .setPropertyStore(PropertiesService.getUserProperties());
  return service;
}

function getFolderById(folderId) {
  var driveService = getDriveService();
  var folder = driveService.getFolderById(folderId);
  return folder;
}

function createFile(imageData, folder) {
  var driveService = getDriveService();
  var file = driveService.createFile(imageData, folder);
  return file;
}