class DriveApp method .searchFiles()

DriveApp is the Apps Script service.

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

What it does

Searches Drive files using a query string.

Why it's used

  • Find all spreadsheets modified this week or owned by a teammate.
  • Power admin tools that audit Drive from a sheet.

Common errors

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

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about DriveApp.searchFiles().

Browse the blog