Pages

Saturday, 7 September 2019

Bulk rename files in Google Drive

The following Google Apps Script is designed to automate bulk renaming of multiple files within a single Google Drive folder. It has been developed as a Google Sheet with flexibility towards entering your own search pattern and replacement string as you see fit.
Screenshot of File renamer text fields
Screenshot of File renamer text fields
There is some validation within the script to help check for errors before proceeding - try/catch when getting the Google Drive folder and 'getui' to display an 'alert' popup if there is a problem with the entered ID.

To perform the actual file rename we use 'replace' once we have done a 'getName'. After which we have a new variable called newName which can then be used to 'setName' back on the file itself.

Bulk rename files in Google Drive.xlsx

2 comments:

  1. thank you for the script. it's really helpful :D

    ReplyDelete
    Replies
    1. Thank you for the feedback. Glad it was useful.

      Delete