class SpreadsheetApp method .flush()

SpreadsheetApp is the Apps Script service.

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

What it does

Forces pending spreadsheet changes to save immediately.

Why it's used

  • Force pending writes to land before the script moves to the next step.
  • Helps when you show a toast or email right after a big batch of updates.

Common errors

  • Forgetting parentheses on flush. Write SpreadsheetApp.flush(), not SpreadsheetApp.flush or flush by itself.
  • Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').flush().
  • Adding spaces where they do not belong. Write SpreadsheetApp.flush(), not SpreadsheetApp .flush(), SpreadsheetApp.flush (), or SpreadsheetApp . flush().
  • Wrong capitalization. Use SpreadsheetApp and flush, not spreadsheetapp or flush.

1 Snippets using this method

Explore

Related methods

  • .clear()

    Removes values, formatting, and notes from a range.

  • .activate()

    Makes a sheet or range the active selection.

  • .setValue()

    Writes a value into a single cell.

  • .prompt()

    Shows a dialog that asks the user for text input.

  • .clearContent()

    Removes only cell values from a range, keeping formatting.

2 Better Sheets tutorials

Automate Emails

Automate Emails

Set up automated email notifications based on Google Sheets data. Super ...
Automatic Calculations

Automatic Calculations

Create custom scripts to make your spreadsheets more like tools.

Related blog posts

Written guides about SpreadsheetApp.flush().

Browse the blog