class DriveApp method .addFile()

DriveApp is the Apps Script service.

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

What it does

Moves a file into a folder.

Why it's used

  • Move an export into the right client folder after creation.
  • File generated reports without manual dragging.

Common errors

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

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

Browse the blog