Google Sheets Add Button With Apps Script Event

July 17, 2019

Create Script Event

Open App Scripts: Google Sheets -> Tools -> Script Editor

Create the following function.

function onClick() {
  SpreadsheetApp.getUi().alert('Hello');
}

Add Image Button

Google Sheet -> Insert

  • Image -> Image over Cells (Google image button generator to generate an Image Button)
  • Drawing: Draw your own button

Click on the 3-vertical-dot on the top-right corner of the imag/drawing, click Assign Script and put in onClick.

Test

Click on the button.

NOTE: To show the 3-vertical-dot again, right click on the button.

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.