class DriveApp method .getFoldersByName()

DriveApp is the Apps Script service.

.getFoldersByName() is the method name you will see after a dot in your code.

What it does

Finds folders in Drive that match a given name.

Why it's used

  • Locate the 2024 Reports folder across a messy Drive.
  • Route new files into an existing folder by name.

Common errors

  • Forgetting parentheses on getFoldersByName. Write DriveApp.getFoldersByName(), not DriveApp.getFoldersByName or getFoldersByName by itself.
  • Skipping dots between chained calls. Each step needs a dot, like DriveApp.getFileById(id).getFoldersByName().
  • Adding spaces where they do not belong. Write DriveApp.getFoldersByName(), not DriveApp .getFoldersByName(), DriveApp.getFoldersByName (), or DriveApp . getFoldersByName().
  • Wrong capitalization. Use DriveApp and getFoldersByName, not driveapp or getfoldersbyname.

Explore

Related methods

Better Sheets tutorials

Automatic Screenshots in Apps Script

Automatic Screenshots in Apps Script

Take Screenshots from URLs in Google Sheets

Take Screenshots from URLs in Google Sheets

Use Screenshot One api to quickly get cached images of Screenshots and t...
Visicalc 2023 Design Walkthrough

Visicalc 2023 Design Walkthrough

Design walkthrough of VisiCalc 2023. Watch this if you'd like to see the...
Visicalc 2023 Quick Walkthrough

Visicalc 2023 Quick Walkthrough

This is a fun template I created for April 1st. Take a quick walk throug...

Related blog posts

Written guides about DriveApp.getFoldersByName().

Browse the blog