How To Make A Button In Google Sheets

In this tutorial, you will learn how to make a button in Google Sheets.

How To Make A Button In Google Sheets

If you use scripts or macros in Google Sheets often, you need a way to run them quickly and easily.

Google Sheets buttons can be placed anywhere you want within your spreadsheet and you can assign a macro or script to run when the button is clicked.

This can save a lot of time if you use that particular action often and also makes your spreadsheet easier to use as you can place the button next to the relevant portion of the spreadsheet.

Creating a Google Sheets Button in 3 Stages

In order to use a button to launch an action, you’ll need to do the following:

  • Create the button using the Google Sheets Drawing feature
  • If you don’t have one already, create a macro to run when the button is clicked. You can also run custom scripts via a button but writing custom scripts is outside the scope of this tutorial
  • Assign the macro to the button so that it runs when the button is clicked

Below, we’ll run through the process of how to:

  1. Create a button
  2. Record a macro
  3. Assign a macro to the button

Let’s check out each of these stages in more detail:

Stage 1 – Create a Button

Google Sheets buttons are highly customizable and can be inserted anywhere in your spreadsheet. To create one follow these steps:

Step 1

Open the insert menu and select the Drawing option:

Step 2

In the Drawing window, click on the Shape toolbar icon and select from the available shape options.

For this example, I selected the simple Rectangle option which is the first option under the Shapes submenu, but there are a lot of shapes to choose between so pick what works best for your spreadsheet:

Step 3

After selecting a shape type, your cursor will change to a cross to show that you can now draw the shape on the shape canvas.

Click and drag on the canvas to add the shape:

After adding it, you can adjust the size as needed by clicking and dragging on the square drag handles in the corners of the shape

Step 4

Double click on the shape and type the text you want to appear on the button.

Step 5

Make any other adjustments to the fill color, border color, font, text alignment or other items in the toolbar, then click done to insert the button into your spreadsheet:

The button will now appear in your spreadsheet, but won’t do anything yet

Stage 2 – Record a Macro

If you already have a macro or script to run with the button, skip this step.

If not, here’s how to record a macro:

Step 1

Open the Tools menu, hover over the Macros submenu to open it, and click on Record Macro:

Step 2

Choose if you want to record the macro using relative or absolute references:

Step 3

Carry out the actions you want recorded in your macro. When you’re done, click Save and name the macro, then click OK:

Your macro is now saved and ready to be assigned to your button

Stage 3 – Assigning a Macro to the Button

The final step is to assign your macro to your button.

Here are the steps:

Step 1

Click on the button and you’ll see a menu icon of 3 vertical dots appear in the corner.

Click on the menu icon and select Assign Script:

 

Step 2

In the window that appears, type in the name of your macro exactly as you typed it when you saved the macro, then hit OK.

If you are assigning a script to the button, type the script name exactly as it appears in the script editor:

Now when you click on the button, the macro you assigned to will run

Summary

Example Spreadsheet: Make a copy of the example spreadsheet

In this tutorial, I covered how to make a button in Google Sheets. Want more? Check out all the Google Sheets Tutorials.