Forces pending spreadsheet changes to save immediately.
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
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.
More Apps Script
2 Better Sheets tutorials
Automate Emails
Related blog posts
Written guides about SpreadsheetApp.flush().
How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →What's Better Than Google Sheets?
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
Read post →How to Send Google Forms Entries Automatically with Apps Script
Google Forms provides basic email notifications for form submissions, but enhancing these notifications with detailed summaries can significantly improve productivity and response management.
Read post →