1
votes

I have no experience in coding however I found a script online to delete folders using folder IDs from a google sheet but it's not working.

Can someone please help?

function deletefolders() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getActiveSheet(); //or getSheetByName() if necessary
    var folderToDelete = sheet.getRange('Sheet1!A2:A4');
    var folderIDs = folderToDelete.getValues();

    folderIDs.forEach(function(id){
      DriveApp.getFolderByID(id).setTrashed(true);
    });
}

The folder IDs are in ColA

1

1 Answers

1
votes

You're trying to use getFolderByID(id), but the correct name of the method is getFolderById(id) with a lowercase d at the end.