Tutorial by Examples

function createNewFolderInGoogleDrive(folderName) { return DriveApp.createFolder(folderName); } Use function createNewFolderInGoogleDrive to create folder named Test folder in a Google Drive root: var newFolder = createNewFolderInGoogleDrive('Test folder'); newFolder has Class Folder typ...
function createGoogleDriveFileOfMimeType() { var content,fileName,newFile;//Declare variable names fileName = "Test File " + new Date().toString().slice(0,15);//Create a new file name with date on end content = "This is the file Content"; newFile = DriveApp.cre...
function createGoogleDriveTextFile() { var content,fileName,newFile;//Declare variable names fileName = "Test Doc " + new Date().toString().slice(0,15);//Create a new file name with date on end content = "This is the file Content"; newFile = DriveApp.createFile...
function createGoogleDriveFileWithBlob() { var blob,character,data,fileName,i,L,max,min,newFile,randomNmbr;//Declare variable names fileName = "Test Blob " + new Date().toString().slice(0,15);//Create a new file name with date on end L = 500;//Define how many times to loo...
function processGoogleDriveFolders() { var arrayAllFolderNames,continuationToken,folders,foldersFromToken,thisFolder;//Declare variable names arrayAllFolderNames = [];//Create an empty array and assign it to this variable name folders = DriveApp.getFolders();//Get all folders from ...
function processGoogleDriveFiles() { var arrayAllFileNames,continuationToken,files,filesFromToken,fileIterator,thisFile;//Declare variable names arrayAllFileNames = [];//Create an empty array and assign it to this variable name files = DriveApp.getFiles();//Get all files from Googl...
function DriveAppAddFolder(child) {//Adds file to the root drive in Google Drive var body,returnedFolder;//Declare variable names if (!child) { body = "There is no folder"; MailApp.sendEmail(Session.getEffectiveUser().getEmail(), "", "Error Adding Folder!&q...
function DriveAppAddFile(child) {//Adds file to the root drive in Google Drive var body,returnedFolder;//Declare variable names if (!child) { body = "There is no file"; MailApp.sendEmail(Session.getEffectiveUser().getEmail(), "", "Error Adding File!",...
function onOpen() { // Add a custom menu to run the script var ss = SpreadsheetApp.getActiveSpreadsheet(); var searchMenuEntries = [ {name: "Run", functionName: "search"}]; ss.addMenu("Get Files", searchMenuEntries); } function getFiles() { // Get...

Page 1 of 1