Creating a zip file inside Google Drive with Apps Script

Actually it’s even easier than that. Files are already Blobs (anything that has getBlob() can be passed in to any function that expects Blobs). So the code looks like this: var folder = DocsList.getFolder(‘path/to/folder’); folder.createFile(Utilities.zip(folder.getFiles(), ‘newFiles.zip’)); Additionally, it won’t work if you have multiple files with the same name in the Folder… Google Drive folders … Read more

In Google Apps Script, how would I get all subfolders and all subsubfolders and all subsubsub folders etc.?

This will recurse through the folder writing them into a spreadsheet. var level=0; function getFnF(folder) { var folder= folder || DriveApp.getRootFolder(); var ss=SpreadsheetApp.getActive(); var sh=ss.getSheetByName(‘FilesAndFolders’) var files=folder.getFiles(); while(files.hasNext()) { var file=files.next(); var firg=sh.getRange(sh.getLastRow() + 1,level + 1); firg.setValue(Utilities.formatString(‘File: %s’, file.getName())); } var subfolders=folder.getFolders() while(subfolders.hasNext()) { var subfolder=subfolders.next(); var forg=sh.getRange(sh.getLastRow() + 1,level + 1); forg.setValue(Utilities.formatString(‘Fldr: %s’, … Read more

Script to convert .XLSX to Google Sheet and move converted file

You want to create the converted Google Spreadsheet files to “FolderB”. You want to delete the XLSX files in “FolderA” after the files were converted. You want to achieve above using Google Apps Script. If my understanding correct, how about this modification? In this modification, I modified your script. Modification points: You can directly create … Read more