How to Insert Spin Button in Google Sheets ( Easy Guide )

In this tutorial, we will learn How to insert Spin Button in Google Sheets.

While working on Microsoft excel it can be easy to insert a spin button or other shapes, the same cannot be true for Google sheets.

This step-by-step guide will help you add a spin button in Google Sheets.

How to insert Spin Button in Google Sheets

Step 1 : Inserting Shapes which will look like the Spin button.

1.On the Main menu go to the insert option ( Main menu ->Insert )

2. Under Insert Menu. select Drawing

Under Insert drop-down menu Click on Drawing as shown below

How to insert Spin Button in Google Sheets

3. Under drawing, option click on shapes

4. Insert the shape depending on your requirement.

  • In this example, I have selected the up arrow. You can also select other shapes

5. Click anywhere on the drawing area and it will insert the previously selected arrow sign.You can resize the arrow as per your requirement.

6. Now click on save and close

  • After saving you can find the selected shape in your google sheets.
  • Similarly, add down arrow and rectangle .

Once both the shapes are inserted in google sheets. You can resize them as per your need.

Once you are finished adding the shapes the final output will look like this :

The next step will be to add a google script code for each button

Step 2 : Writing a Google script for each button

Here we will use the increment and decrement function.

code for increment and decrement function.

Increment Number by 1:

function increment() {
 SpreadsheetApp.getActiveSheet().getRange('A10').setValue(SpreadsheetApp.getActiveSheet().getRange('A10').getValue() + 1);

Decrement Number by 1:

function decrement() {
 SpreadsheetApp.getActiveSheet().getRange('A10').setValue(SpreadsheetApp.getActiveSheet().getRange('A10').getValue() - 1);

Follow the below steps to add the above code to google sheets.

  • Go to script editor under the tools menu .
  • Once you click on the Script Editor it will open the Apps Script editor
  • Copy and paset the previously mentioned increment and decrement functon code in code.js window.
  • Save the project and close the Apps script editor
  • The above steps will add the increment and decrement function in your google sheets.
  • The next step is to assign these functions to the shapes added to our google sheets.

How to assign google script to the Shapes.

Follow the below steps to assign the google script.

  • Select the shape (in this example up arrow ) and click on the three dots as shown below.Once you click on three dots you will get the option to assign script.
  • Click on Assign a script.
  • Specify the name of the function ( in this example increment )
  • Similarly, assign the decrement function to a down arrow shape.
  • Once both the functions are assigned click on any arrow .
  • During the first run it will take some time and you will get a below message “Running script”
  • After that it will ask you for authorization .Click on continue and provide the authorization.
  • Now your spin button is ready. You can click on the up and down arrow to increment as shown below.
How to Insert Spin Button in Google Sheets

The above-provided steps will help you to add a spin button easily to your google sheets.

To know more about Google Apps Script. Check the below-provided link

official google apps script documentation

We hope this tutorial on How to insert Spin Button in Google Sheets was helpful.

Other useful Articles:

How to Freeze Rows in Google Sheets

How to add code blocks in google docs

How to recover deleted google sheets

How To Transpose Data in Google Sheets

How to count non-empty cells in google sheets

1 thought on “How to Insert Spin Button in Google Sheets ( Easy Guide )”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.