Skip to content

Instantly share code, notes, and snippets.

@mrlynn
Created March 3, 2019 16:05
Show Gist options
  • Save mrlynn/4bc4d6ce9104d2ab2000100a7191b53b to your computer and use it in GitHub Desktop.
Save mrlynn/4bc4d6ce9104d2ab2000100a7191b53b to your computer and use it in GitHub Desktop.
Google Sheet Script to Create a Menu Item OnOpen - part of Stitching Sheets blog article
/****
* This function runs automatically and adds a menu item to Google Sheets
****/
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
sheet.setActiveSheet(sheet.getSheetByName("Events"));
var entries = [{
name : "Export Events to MongoDB",
functionName : "exportEventsToMongoDB"
},{
name: "Remove All Events from MongoDB (Delete Documents)",
functionName: "removeEventsFromMongoDB"
}];
sheet.addMenu("Demo Stitch Sheets Integration", entries);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment