Helo
Im newbies on google script, I have a Google Drive folder list in Google Sheet, how do I delete folders on Google Drive based on the data on the Google sheet?
Helo
Im newbies on google script, I have a Google Drive folder list in Google Sheet, how do I delete folders on Google Drive based on the data on the Google sheet?
If you have the ID you can use the getFolderByID() method followed by the setTrashed() one.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet(); //or getSheetByName() if necessary
var folderToDelete = sheet.getRange(<range of your folder IDs list>);
var folderIDs = folderToDelete.getValues();
folderIDs.forEach(function(id){
DriveApp.getFolderByID(id).setTrashed(true);
});