How to Make a Button in Google Sheets (3 Methods)

how to Make a Button in Google Sheets 29
Key Takeaways: How to Make a Button in Google Sheets

To Make a Button in Google Sheets

  1. Select an empty cell.
  2. Go to “Insert” > “Image” > “Insert an image over the cell“.
  3. Choose an image file with a transparent background.
  4. Resize and position the image.
  5. Right-click the image, select “Assign a script,” and choose a function.
  6. Test the button’s functionality.

OR

  1. Go to “Insert” > “Drawing” > Choose a shape, like a rounded square.
  2. Draw the button shape and apply a gradient fill.
  3. Add text as the button label.
  4. Center-align the text.
  5. Save and close the drawing to insert the button.
  6. Right-click the button, select “Assign a script,” and choose a function.
  7. Verify that the button performs the desired action.

Hi everyone, in this article, we will learn about how to make a button in Google Sheets.

We interact will many applications in our day-to-day life and using that application we click many buttons to do things. So, we understand the importance of buttons in the user experience, in google sheets, we can have buttons for performing certain actions just like we have an HTML button tag that adds a button on a web page and then is programmed by JavaScript. Similarly, we add a button in our google sheets file and program it using AppScript or Macro. This article focuses on creating buttons and assigning them the functions to perform.

Use case of a Button in Google Sheets

As we have App scripts and Macros, they help us automate google sheets. But we have to manually go into the extension tab to run a macro or script, although we have shortcuts for that purpose still, the buttons are more interactive.

What if we could add certain buttons, custom design them and give them unique functionalities to perform when clicked? Sounds interesting, this is why we need to learn how to make a button in google sheets. Buttons increase the overall experience of users on our document, they enhance the design aesthetics of the overall document, and of course, they give quick performance clicking on a button will instantly perform the specified action. These are some reasons we need to learn how to make a button in google sheets.

How to Make a Button in Google Sheets

Now we will see the steps included to make a button in google sheets. We have two methods to add buttons (in fact three methods, but only two are recommended and used widely). So we will learn each method step-by-step. Let’s move on to the methods. Why do we need to learn – How to Make a Button in Google Sheets?

How to Make a Button in Google Sheets – By Inserting an Image

In this first section, we will learn how to make a button in google sheets by inserting an image, an image should be a vector image, and must have a transparent background (any image can be added but to make a button we must take care of these two things). We will add an image in this method and will also see how to assign an App Script function to this button let’s move to the steps required to do this.

Step 1

Some sample data to ensure the function is working accurately

how to Make a Button in Google Sheets 1

Step 2

Select any empty cell

how to Make a Button in Google Sheets 2

Step 3

Go to Insert > Image > Insert an image over the cell

how to Make a Button in Google Sheets 3

Step 4

Click on browse, or you can drag and drop the file.

how to Make a Button in Google Sheets 4

Step 5

Pick an image and select it from the directory

how to Make a Button in Google Sheets 5

Step 6

Your image is added, and you can resize, and move it anywhere freely.

how to Make a Button in Google Sheets 6

how to Make a Button in Google Sheets 7

How to Make a Button in Google Sheets – Assign a Script to Image

Since the image is added, now we need to assign a script to the image. For that simply follow the below steps

Step 1

Right-click on the image

how to Make a Button in Google Sheets 8

Step 2

Click on three dots on the top right corner

how to Make a Button in Google Sheets 9

Step 3

Now you need a script to assign it to an image, I will provide the script below you can copy and use it for your practice.

Step 4

From the available options, click on “Assign a script”

how to Make a Button in Google Sheets 10

Step 5

A pop-up will appear

Assign script

What script do you want to assign?

In the below text box Write your app script name and click the OK button

how to Make a Button in Google Sheets 11

Step 6

The script is assigned to your button now click the button and see the function will be performed automatically

how to Make a Button in Google Sheets 12

The Script used in this example is

function onEdit(e) {

var ss = SpreadsheetApp.getActiveSheet();

var range = ss.getRange(1, 1, ss.getMaxRows(), ss.getMaxColumns());

range.clearFormat();

}

 

This script simply resets the default formatting.

How to Add Script Code to your Google Sheets File

Step 1

Copy the code

how to Make a Button in Google Sheets 13

Step 2

Go to Sheet, Go to Extensions > Apps Script

how to Make a Button in Google Sheets 14

Step 3

A code editor will open, remove all and paste the code

how to Make a Button in Google Sheets 15

Step 4

Click on Save

how to Make a Button in Google Sheets 16

How to Make a Button in Google Sheets using Drawing Tool

In this section we will learn how to make a button in google sheets by drawing a button using a drawing tool, the drawing tool is built-in in Google Sheets. We will use it to draw a button and will insert it into our sheets, and then similarly we will assign a script to it to perform certain actions. Let’s move on to the below steps to see how to draw a button

Step 1

Go to insert > Drawing

how to Make a Button in Google Sheets 17

Step 2

An art bot will open. In the drawing tool menu, click on the shape

how to Make a Button in Google Sheets 18

Step 3

Select shapes, and pick a shape from many given shapes (a rounded square is recommended)

how to Make a Button in Google Sheets 19

Step 4

As you selected a shape, a drawing cursor will appear, drag it and draw the body of the rounded square.

how to Make a Button in Google Sheets 20

how to Make a Button in Google Sheets 21

Step 5

After the outline, you need color. Select your shape and go to Fill color

how to Make a Button in Google Sheets 22

Step 6

Select Gradient

how to Make a Button in Google Sheets 23

 

Step 7

Pick any gradient you like; your gradient will be added.

how to Make a Button in Google Sheets 24

how to Make a Button in Google Sheets 25

Step 8

Now you need the text (the button name), select the shape, and click on a text box in the tool menu

how to Make a Button in Google Sheets 26

Step 9

Now inside your shape draw a text box under the shape.

how to Make a Button in Google Sheets 27

Step 10

Write your text

how to Make a Button in Google Sheets 28

Step 11

Center align the text box and the text

how to Make a Button in Google Sheets 29

how to Make a Button in Google Sheets 30

Step 12

Click on save and close and your button will be added to your sheets

how to Make a Button in Google Sheets 31

how to Make a Button in Google Sheets 32

 

As you have done with the drawing of the button, now you can assign the script similarly as we assigned to the image we used in the previous method.

Let’s see it briefly for the button as well

Step 1

Right-click on the button and click on 3 dots on the top right corner

how to Make a Button in Google Sheets 33

Step 2

Click on assign a script

how to Make a Button in Google Sheets 34

Step 3

Add the script name and click on the Ok button

how to Make a Button in Google Sheets 35

Step 4

Now verify by clicking on the button

how to Make a Button in Google Sheets 36

This is how you do it, we have learned two methods to add buttons in google sheets, you can also use one more method but that is not user friendly and that’s why I did not include in this article the method is “insert an image in the cell” because it does not give you the flexibility to move and resize the image.

Download/Copy Free Google Sheets Template

How to Make a Button in Google Sheets

Notes

  • Always remember to add the image over cells, not in the cell
  • Adding an image in the cell is not used, because it bounds your image inside a cell and it cannot be resized or moved in any way.
  • Always try to keep the buttons less colorful using light gradients instead of solid colors
  • You can assign any kind of script to the button; the script function will be assigned to the button.
  • The button you draw, can take any kind of script and perform a specific function for you
  • Always add a transparent image as a button to look more professional
  • The name of your project is not your script name, many beginners get confused about it, your script name is the name of the main function written in the script.

Frequently Asked Questions

How to add an image as a button in google sheets?

You can add an image to your google sheets as a button by going to insert > image > insert image over cells. Select the file from the options, Upload, Camera, URL, Photos, Google Drive, Google image search, use upload and upload your image on the sheets, then right click on the image on the three dots to find more options, now find the option assign a script and it will ask the name of the script, provide the name and click on the Ok button.

Can I Use AppScript to Create a Button in Google Sheets Like I Can With a Sidebar?

Yes, you can use AppScript for google sheets sidebar creation to create a button just like you can with a sidebar. It provides a convenient way to enhance the functionality of your Google Sheets by adding custom buttons that perform specific tasks. With AppScript, you can easily create a button that automates actions or triggers a script within your Google Sheets.

How to draw an image as a button in google sheets?

You can go to insert > drawing to go into the drawing interface, in the drawing tool you have several options, select a starting shape and make the outline of the button, it can be circled, square, rounded square, or of any common shape, now assign some colors (gradient recommended). then you need to add the text (button name), add a text box from the toolbar and draw a box, write the text and when you’re done click on save and close, and the button will be added to your sheets. Now, right-click and click on three dots to open more options, find the options “assign a script” click on it and it will ask for the name of the script provide the name, and click the Ok button.

I don’t know my script name? how can I find it?

Your script name is the name of the function that appears on the top menu before the “Execution log”. You can find it on the first line after the function keyword.

Conclusion

Wrapping up how to make a button in Google sheets, we have learned about the buttons in every detail, in the above introductory sections, we have seen what are buttons and why they are important? Then, we discussed the two best methods to add images in your google sheets file as a button then we saw how to assign the app script code to those buttons and verified the buttons are working perfectly, and we have seen how to draw a basic button in google sheets drawing tool.

I hope you have enjoyed this article and found it useful, please don’t forget to share the article with your friends. Give a like and share your thoughts below in the comment section. That’s all from how to make a button in google sheets, will see you very soon in the next article till then take care. Keep learning with Office Demy.

Content Protection by DMCA.com

M. Shaiq Ansari

Hi, I am Shaiq, I am a highly skilled technical writer working full-time for Office Demy. I am specialized in Google Workspace and Microsoft Office applications. With a background in Software Engineering, I possess a deep understanding of the intricate functionalities and features of these productivity tools. Connect me on Linkedin https://www.linkedin.com/in/shaiq-ansari/

OfficeDemy.com
Logo
Enable registration in settings - general