How to Record a Macro in Google Sheets and run it whenever necessary

Spreadsheet platforms are used by almost everybody these days, and carrying out repetitive tasks is also something most people need. Similarly, if you need to carry out the same set of repetitive tasks every day at your workplace on any spreadsheet program, you can save a ton of time by automating those tasks. You simply need to record a macro and run it later when you want to execute the tasks. 

Google Sheets is currently the most popular spreadsheet platform these days for collaborative abilities and other advanced functionalities. You can also record a macro on Google Sheets to automate repetitive tasks. That said, today I will basically talk about how to record a macro in Google Sheets, and then run the same whenever necessary.

So, without any further delay, let’s get started with how to record and run macros in Google Sheets.

I will explain the creation of the macro using an example. In the example, we have a set of values in the range (C4:C12).

The macro will pull the numerical values from these cells to the range (F4:F12), and the sum of the numbers will be placed in cell F13.

Macros in Google Sheets 10

Recording a macro in Google Sheets

Click on ‘Extensions’, and in the menu, hover over to ‘Macros’. In the ‘Macros’ menu, click on ‘Record macro’.

Recording a macro

While executing macros make sure that ‘Use absolute references’, is selected, which, however, should be selected by default. That will record the absolute addresses of the cells that are effortless to deal with, compared to choosing relative references, which will record the relative addresses of the cells.

Now, carry out the tasks that need to be repeated. In my example here, I will copy the cell contents in the range (C4:C12) to (F4:F12).

While this is a simple task, your tasks can be more complex. Don’t worry as the macro will record it all.

After you are done executing all the steps, click on ‘Save’.

Select the options

The last step is to assign a name to the macro. You can assign any name to the macro. So select a name that you find relevant to the steps in the macro. You can assign a shortcut key to the macro as well, but that is optional. Once you are done, click on ‘Save’.

The macro is now recorded.

Save a new macro Google sheet

Executing a pre-recorded macro in Google Sheets

Now that you know how to create a macro, here are the steps to execute a macro that is already recorded.

In the ‘Extensions’ menu, hover over to ‘Macros’, and click on the name of the macro that you want to execute. Here, the name of the macro that I created is ‘Sum of values’.

Executing a pre-recorded in Google Sheets 50

For the very first time, authorization is required to connect Google Sheets with the macros as the macros are extensions that first require authorization before they can be used.

Just click on ‘Continue’ when asked, to proceed.

Allow macro to run in Google sheet

A new window will appear where you have to sign in with your Google account.

Sign using Googlr account

Go through the steps again, click on the name of the macro, and the tasks assigned within the macro will be executed.

Based on the number of steps, executing the macro might take some time, and you have to be patient till then. After all, having this much patience is better than executing all the steps manually.

So, that’s how to create and record a macro in Google Sheets. Just like macros in other platforms, you cannot modify the steps in a macro unless you know Apps Script.

Apps Script is developed by Google, and you can modify the script if you want to finetune the steps. But, you should know how to use Apps Script, before you can think of making any changes.

Managing a macro in Google Sheets

In the ‘Extensions’ menu, click on ‘Manage macros’ that you can find in the ‘Macros’ section.

Managing a macro in Google Sheets 90

In the ‘Manage macros’ menu, click on the triple-dot icon corresponding to the macro that you want to manage.

Click on ‘Remove’ to remove the macro, or click on ‘Edit script’ to make changes to the script.

Edit script

If you want to edit the script, here’s a glimpse of the editor, where you can make the necessary changes.

Macros in Google Sheets 110

So, that’s all about how to record a macro and run it when you want. Do you have any questions regarding the topic? Feel free to comment on the same below.