Batch rename Google Drive Content (like Untitled Docs & Sheets)

Nick Young
2 min readJan 8, 2022


Originally posted in

Fix your “Untitled Documents” and “Untitled Sheets” using some Apps Script to automate a rename, using the file’s own contents.

This one’s easy…everyone gets lazy sometimes, and ends up with a bunch of “Untitled Spreadsheet” or “Untitled Documents” in their Google Drive files list. This Apps Script will search for those files, and rename them using the file’s own contents (document header or body text, or the value in cell A1 of a sheet).

You can adjust the code as you’d like of course, if this doesn’t work for your purpose…or you can use this to rename things in batch without using what’s in the file’s contents too I guess.

  1. Create a Google Spreadsheet to hold the results (to show what was renamed)
  2. In the sheet, click the menu for Extensions -> Apps Script
  3. Copy the code from this repo, and paste it into the file
  4. Copy the code from the email.html file in the same repo, and create an email.html in Apps Script too
  5. Add the Docs and Sheets “Services” on the left hand. side using the + icon in the “Services” section.
  6. Update the variables at the top of the script according to your own setup/preference.
  7. Run the function for setting the sheet headers, which will prompt you to grant permissions for the script to run on your account. Accept these prompts.
  8. Run the function to find and rename the files, according to. your variable configuration.
  9. Check the google sheet when it’s done to see what it found and what it renamed things to (just in case you need to revert anything manually).
  10. That’s it.
  11. If you have so many that it takes more than 3.5 minutes to run on your account, you can run it again manually, or set a trigger to run on a schedule. It will email you when it’s finished with all the files it finds.

Hopefully it’s helpful to people who need to bulk rename their google drive contents easily/efficiently.

Check out my other scripts on or

Originally published at on January 8, 2022.



Nick Young

Cloud stuff, data, analytics; Google, Internet2 Advisory Boards & working groups. Higher Ed IT since 2002. @techupover and @usaussie on twitter