Skip to content

Instantly share code, notes, and snippets.

@ehershey
Last active July 9, 2021 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehershey/1ea9552cfadbe43bba4abad1213b24a4 to your computer and use it in GitHub Desktop.
Save ehershey/1ea9552cfadbe43bba4abad1213b24a4 to your computer and use it in GitHub Desktop.
// Google Sheets Script
//
// 1. In the Tools Menu, select "Script Editor"
// 2. Paste this in replacing all text in the script editor
// 3. Click disk icon to "Save Project"
// 4. Refresh spreadsheet
// 5. Be patient and a new "Custom" menu will appear
//
// add a single row to every sheet in the current spreadsheet
function addRowToEverySheet() {
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
for (var i = 0; i < sheets.length; i++) {
sheets[i].appendRow([""]);
}
}
// add a menu item to call the function that adds a single row to every sheet in the current spreadsheet
function onOpen() {
SpreadsheetApp.getActiveSpreadsheet().addMenu("Custom", [{name: "Add row to every sheet", functionName: "addRowToEverySheet"}]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment