Google Sheets Macro helps users automate repetitive tasks. All they need to do is record the steps, and the software creates a program to auto-execute those steps with a click of a button. Users don’t need to have any coding knowledge to use Macros in Google Sheets.
You may be creating a chart from monthly sales data or obtaining the number of products sold over a month using a formula. Everything can be recorded and automated using Macros.
Applying the same formatting to a range of charts can be the perfect example here.
It’s okay to format the charts if the count is low, but what if you have to apply the same formatting to tens and hundreds of charts?
In that case, Google Sheets Macros is your way to go!
Welcome to this blog! Let us discuss Google Sheets Macro and uncover its benefits and drawbacks.
Benefits of using Google Sheets Macros
Repetitive tasks are tedious and time-consuming.
Consider the dataset whose type and size don’t change frequently, and you are analyzing or organizing it in a set pattern. For example, your job is to prepare daily sales graphs from the e-commerce data downloaded bi-weekly.
Here are the steps you might be going through,
- Select specific columns
- Insert the chart
- Apply formatting (change the text styles, adjust the text and background colors, remove axis lines, add the titles, etc.)
The above tasks may not take significant time when you need to create 1-2 charts, but things will surely get complicated in the case of 5-10 charts every week.
Macros help you automate those steps. You can create any number of charts with a click in a matter of minutes.
Here are a few more benefits of using Macros in Google Sheets:
- Saves Time – Users will save significant time automating repetitive tasks.
- Improves Productivity – By automating tasks, employees can focus on other things that matter most to them.
- Enhances Accuracy – Macros help users deliver quality work consistently. There will be fewer chances for mistakes.
How to Record Macros in Google Sheets (The Beginners Guide)
Let us discuss the step-by-step process to record macros in Google Sheets.
Note that by recording the macros, you will be creating an Apps Script code. However, you don’t need any knowledge of both the Apps Script and coding to use the Google Sheets Macro.
Now, without any further ado, let’s get started.
STEP #1 – Open the Desired Google Sheet
Go to your Google Drive and locate the spreadsheet that holds the data you organize or analyze frequently.
If you have downloaded the file from the internet, then it may be in the .csv, .xlsx, .html, etc. file format.
To import such files to Google Sheets, here is the process:
- Open a new Google Sheet by clicking here
- Hover to the main menu
- Click on the “File” button
- Choose “Import” from the popup
- A new dialog box will open as shown below,
- Click on the “Upload” tab
- Now, click the “Browse” button and locate the file on your local drive
- Press the “Open” button
- Google Sheets will take some time, depending on the size of your data. Once the import is completed, you will see the following popup,
- Click the dropdown below the “Import location” button
- Select “Insert new sheet(s)” option
- Press the “Import data” button
Now, your dataset is ready for further analysis.
STEP #2 – Record the Macro
This is the crucial step where we will actually record the macro.
For the sake of this article, let us create a chart representing the sales reps and the sales generated by them over time.
Here’s how the table looks. We have employee names in the first column and sales generated by them in the third column.
![Google Sheets Macros - How to Record Macros in Google Sheets [2024]](https://softwareaccountant.com/wp-content/uploads/2024/01/image-69.png.webp)
Let’s begin,
- Hover to the main menu
- Click on the “Extensions” tab
- Select “Macros” from the popup
- Now, choose the “Record macro” option
- A new popup will be displayed as shown below,
- Make sure the Radio button before the “Use absolute references” option is ticked
- Next, go ahead and create the chart
Every time you make the changes, they will be reflected in the following section of the Record Macro popup.

You can stop at any time to save the macro. However, make sure to be specific and correctly execute all the steps to avoid future errors.
Also, there is no such limit on how long you will be recording the macros or the number of steps, so try to record all the necessary steps.
Q. What to choose between Absolute and Relative References while recording the Macros in Google Sheets?
As you might have noticed, there are two options while recording the macros:
- Absolute References – This option lets users tell Google Sheets to use the same range of cells, including their location, while executing the macros in the future.
- Relative References – It is beneficial when you are recording the macro, which includes formulas. Google Sheets Macro will consider the active selection (cursor location) as the reference while executing the macros in the future.
In the case of charts, graphs, and formatting macros, you can choose Absolute References. Whereas, in the case of the formulas, go with the Relative References.
STEP #3 – Save the Macro
Once you have recorded the macro successfully, click the Save button on the upper-rightmost corner of the popup.

A new dialog box will open where you can enter the name of your Macro. Refer to the following image.

I have put “Chart Macro” as the name of the macro we recorded in the previous step.
Google Sheets will take some time to finish recording. You can see the status at the lower-leftmost corner of the screen.

STEP 4 – Authorize and Run the Macro
Users need to allow permissions to the Apps Script to run the code. In the case of Macros, which are also the Apps Script codes created on behalf of the users by the Google Sheets, authorization is required.
There is no separate tool to authorize the micro; you are asked to do it while running the micro for the first time.
Here are the steps to authorize and run the micro we have created in the previous steps:
- Hover to the main menu
- Click on the “Extensions” tab
- Choose “Macros” from the popup
- Now, you will see the recorded macro at the bottom of the list. Refer to the following image,
- Click on the “Chart Macro”
(In the previous step, we have named our macro as “Chart Macro”) - A new popup will be displayed, as shown in the following image
- Click the “OK” button
- A new window will be opened on your browser, as shown below
- Choose the Google account
- Next, you need to grant permissions by scrolling down and clicking the “Allow” button
You will be redirected to the Google Sheets.
Next time, Google Sheets will instantly create and format the sales chart using the new data. Your new graph will be displayed within a few seconds.

That’s the beauty of Google Sheets Macros! You can execute a repetitive task that could take hours within a few seconds.
How to View and Edit Apps Script Code for Macros in Google Sheets
As we discussed earlier, Macros are nothing but the Apps Script codes that are created by Google Sheets on behalf of the users using the steps recorded by them.
Beginners may record the Macro and run it after that through the main menu or using the keyboard shortcuts.
However, it is possible for advanced users to access and edit the Apps Script code for Macros.
The steps to view the code are as follows,
- Open the Google Sheet in which you have created the Macros
- Hover to the main menu and click on the “Extensions” tab
- Choose “Macros” from the popup
- Then, select the “Manage macros” from the list
- A new dialogue box will be displayed, as shown in the following image
- Click the three dots
- Select the “Edit script” from the list
- You will be redirected to a new tab (Apps Script Editor) on your browser
The code is displayed in the editor window, as shown below. Note that the code may vary in your case based on the Macros recorded by you.

You can edit the script as per your wish. Make sure to hit the save button from the toolbar section to apply the changes made by you.

How to Import Macros from One Google Sheet to Another
Importing Macros from one Google Sheet to another is quite a lengthy process.
However, it is supposed to save your time by leveraging the already recorded Macros.
We have divided the steps to importing the Macros as follows:
STEP #1 – Getting the Apps Script Code for the Macros recorded in the source file
In the first step, you need to get the code for the macros you wish to import.
Here’s the process,
- Open the source or primary Google Sheets
- Hover to the main menu and click on the “Extensions” tab
- Choose the “Macros” option from the popup
- Click on the “Manage macros”
- A new dialog box will open, as shown below
- Click the three dots as shown in the following image
- Next, select “Edit script” from the list
- A new tab will be opened on your browser
- Select the entire code from the Apps Script editor
- Copy the code on your clipboard using the keyboard shortcut “CTRL +C”
We will be using the copied code in the following section. Avoid making edits to the existing code while copying; otherwise, it may lead to errors.
STEP #2 – Record a new Macros in the destination file
You cannot directly import the Macros from one sheet to another until and unless at least one Macros exists in the second or destination Google Sheets.
Follow the steps below to create a Macros in the destination Google Sheets:
- Open the Google Sheets where you wish to import the Macros
- Hover to the Main menu
- Click on the “Extensions” tab
- Select the “Macros” option from the popup
- Now, choose “Record macro” from the second popup
- A new popup will appear at the bottom of the screen, as shown below
- Next, click the “Save” button
- Enter the name of the Macro
- Press the “Save” button
STEP #3 – Paste the Apps Script Code
Once the new Macro in the destination Google Sheets is created, we need to edit the Apps Script code.
Let’s begin,
- Open the destination or secondary Google Sheet
- Click on the “Extensions” tab from the Main menu
- Choose “Macros” from the popup
- Now, select the “Manage macros”
- A new popup will be displayed
- Click the three dots as shown in the following image,
- Select the “Edit script” option
- You will be redirected to a new tab on your browser
- Select the entire existing code and press the “Delete” button on your keyboard
- Paste the code copied in the first step using the keyboard shortcut “CTRL +V”
- Press the “Save” button from the toolbar section. Refer to the following image
After pasting the code, you can close the Apps Script tab on your browser and go back to the Google Sheets.
There, you will find the Manage macros dialog box; close it by pressing the “Cancel” button as shown in the following image.

STEP #4 – Import Macro
This is the final step in importing the Macros from one Google Sheet to another.
- In the destination or secondary Google Sheets, go to the Main menu and click the “Extensions” button
- Select the “Macros” option from the popup
- Choose the “Import macro” option
- You will see a new dialog box as shown in the following image,
- Click the “Add function” button
- Close the dialog box using the “x” at the upper-rightmost corner
With this step, your macros have been imported from the source Google Sheets to the destination Google Sheets.
STEP #5 – Run the imported macro
Here are the steps to run the macro we have imported in the previous step.
Note that while running the macros for the first time, you need to authorize it (the Apps Script code) to make changes to your Google Sheets.
Let’s begin,
- Open the destination or secondary Google Sheets
- Go to the main menu
- Click the “Extensions” tab
- Choose the “Macros” option from the popup
- Now, select the imported Macro. In our case, it is named “Chart Macro 2,” as shown in the following image,
- A new popup will be displayed as shown below, asking for you to authorize the Apps Script code
- Press the “OK” button
- A new dialog box will appear as shown below
- Choose the Google account
- Next, you need to grant permissions by clicking the “Allow” button
Once you click the “Allow” button, the dialog box will close, and you will be taken back to the Google Sheets.
Here’s the output.

A notification will appear at the bottom of the screen saying the Apps Script project is running and finished.
How to Create A Keyboard Shortcut to Run Macros in Google Sheets
Google Sheets allows you to create a dedicated keyboard shortcut for the recorded Macros.
It is the quickest way to run the Macros compared to going to the main menu and selecting the options manually.
In this section, we will learn the steps to create a keyboard shortcut to run the Macros recorded above.
Let’s begin,
- Open the Google Sheets in which you have created the Macros
- Hover to the Main menu
- Click on the “Extensions” tab
- Choose the “Macros” option from the popup
- Select “Manage macros”
- A new dialog box will appear on the screen
- All the macros recorded by you should appear in this list
- Beside the name of each Macro, you are supposed to see “Ctrl + Alt + Shift +” as shown in the following image
- You need to enter the numbers between 0 to 9 in the empty box. Refer to the next image,
(I am putting the number “1” for the sake of demonstration)- Finally, press the “Update” button to close the dialog box
So, next time onwards, I will run the Macros recorded for creating the chart (discussed in the above section of this article) using the following keyboard shortcut.
CTRL + ALT + SHIFT + 1
Note that you can choose any number between 0 to 9 along with the “Ctrl + Alt + Shift” as the keyboard shortcut to run the Macros. It also means that you can create a maximum of 10 keyboard shortcuts to run the Macros using Google Sheets.
Limitations of Google Sheets Macros
Before you start using Macros in Google Sheets, make sure you know the following things to make the most out of it.
Though they are easy to use, sometimes you may quickly run into errors.
Here are the things to take care of while using Macros in Google Sheets:
- Users can’t use Google Macros between various Google Workspace tools.
- Macros are limited to Google Sheets in which they are created. You cannot record macros between separate workbooks.
- Google Sheets doesn’t allow users to share the Macros between their spreadsheets from Google Drive.
Simply put, Google Sheets Macros are limited to the file in which they are created.
FAQs
Q. How do I delete Google Sheets Macros?
You can easily create and remove macros from the Google Sheets.
In the above section of this article, we have discussed the steps to create and import macros in Google Sheets. Now, let’s see how you can delete a macro that’s no longer useful.
- Hover to the main menu
- Click on the “Extensions” tab
- Select the “Macros” option from the popup
- Next, click the “Manage macros”
- A new popup will be displayed on your screen, as shown below
- Click the three dots beside the name of the macro you wish to delete
- Choose the “Remove” option from the list
- Press the “Update” button to close the popup
Removing a macro creates a space for a new keyboard shortcut because the users are allowed to create up to 10 keyboard shortcuts to run the macros.
Q. Can I run VBA Macros in Google Sheets?
The Visual Basic for Application (VBA) code can’t be used with Google Sheets because it uses the Apps Script, which runs on modern JavaScript.
Both VBA and Apps Script are used to automate repetitive tasks in the respective spreadsheet software. However, the code created in either of them doesn’t work with the other.
Google Workspace (Paid) users have the advantage here. They will get access to the Macro Converter, which converts VBA macros to Apps Script code in a few seconds.
Q. What is Apps Script in Google Sheets?
Google Suite products use Apps Script to automate repetitive tasks.
It is a rapid application development platform that runs on JavaScript. Simply put, the Apps Script is a platform where you can write the codes to do more with your Google products, such as Sheets, Docs, Gmail, etc.
When the user records a macro, it is converted to App Script code by Google Sheets. You can edit or export the Apps Script code for the macros as discussed in the above section of this article.
To Summarize: Google Sheets Macro
Users can record a set of actions, which will be converted into an Apps Script code using Google Sheets. The code is known as the Macros, which can be reused any time in the future to execute those tasks with a click of a button.
Macros are an excellent way to automate tasks, save time, and improve productivity.
I hope you learned all the bells and whistles of recording and running macros, along with their benefits and limitations.
Let us know in the comment section if you are stuck somewhere or having any particular issues recording or running macros in Google Sheets.
For more such tips and tricks to use Google Sheets like a pro, remember to refer to our blog.