class DriveApp method .removeFile()

DriveApp is the Apps Script service.

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

What it does

Removes a file from a folder without deleting it.

Why it's used

  • Take a file out of a folder without deleting it from Drive.
  • Tidy staging folders after processing uploads.

Common errors

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

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.removeFile().

Browse the blog