Get help

Help center

Guides and answers

Contact support

Write to our team

Sign in to

Workflows

Build processes with your team

Automations

Connect files and automate tasks

One system, four parts

AI agents

Virtual Employees that work 24/7

Automations

Connect files and automate tasks

Workflows

Build processes with your team

Data Space

Trusted data sharing and control

Solutions by department

Finance

Reports, budgets, and reconciliations

Inventory and manufacturing

Stock, orders, and production in one view

HR

Timesheets, attendance, and reviews

Project management

Status and workload across projects

Sales and CRM

Leads and deals kept up to date

Education

Student records and school data

Finance

Turn manual finance work into reports that update themselves.

What Finance teams automate

  • Track payables and receivables
  • Build cash flow statements
  • Compare budget against actuals

Inventory and manufacturing

See stock levels and automate ordering.

What inventory and manufacturing teams automate

  • Track inventory across multiple sites
  • Connect sales, purchasing, and warehouse data
  • Link a barcode scanner to your sheet

HR

Run recruitment, attendance, and OKR tracking from your sheets.

What HR teams automate

  • Track recruitment and onboarding
  • Record team OKRs and results
  • Track check-ins, check-outs, and leave

Project management

Assign tasks and track hours without manual updates.

What project teams automate

  • Assign tasks and track status changes
  • Estimate effort and log hours worked
  • Track milestones across projects

Sales and CRM

Track leads and sales performance with automated reports.

What sales teams automate

  • Track and convert leads
  • Set sales goals and track team metrics
  • Monitor sales KPIs on dashboards

Education

Automate attendance, grades, and school purchasing.

What schools automate

  • Track attendance and notify parents
  • Record and compare class grades
  • Track inventory lent to students and staff

Find a use case

By department

How each team uses Sheetgo

By industry

How each industry uses Sheetgo

By company size

Small, medium-sized, or large

Learn

Blog

Guides and product news

Customer stories

How teams like yours use Sheetgo

Help center

Guides and answers

Why Sheetgo

Compare

How Sheetgo compares with other tools

Security

How we protect your data

Trust center

Our compliance details

Sign in to

Workflows

Build processes with your team

Automations

Connect files and automate tasks

One system, four parts

AI agents

Virtual Employees that work 24/7

Automations

Connect files and automate tasks

Workflows

Build processes with your team

Data Space

Trusted data sharing and control

Solutions by department

Finance

Reports, budgets, and reconciliations

Inventory and manufacturing

Stock, orders, and production in one view

HR

Timesheets, attendance, and reviews

Project management

Status and workload across projects

Sales and CRM

Leads and deals kept up to date

Education

Student records and school data

Find a use case

By department

How each team uses Sheetgo

By industry

How each industry uses Sheetgo

By company size

Small, medium-sized, or large

Get started

Templates

Ready-made workflows to start from

Learn

Blog

Guides and product news

Customer stories

How teams like yours use Sheetgo

Help center

Guides and answers

Why Sheetgo

Compare

How Sheetgo compares with other tools

Security

How we protect your data

Trust center

Our compliance details

Help center

Guides and answers

Contact support

Write to our team

Workflows

Build processes with your team

Automations

Connect files and automate tasks

Google Sheets macros: how to enable, create and use them

Google Sheets macros let you record a routine task once, such as formatting a table or tidying up a report, and replay it with a click or a keyboard shortcut. You don’t need to write code to record one, and every macro is saved as Google Apps Script, so you can edit it later.

This guide explains what macros are, why Google Sheets has no setting to enable them, and how to record, run, edit, and import your own. It ends with two examples you can copy.

What are Google Sheets macros?

Macros are small programs that you can create within Google Sheets. Since you don’t need to use code, it’s become a highly valuable feature to automate repetitive tasks, regardless of the user level. For example, if a regular task in your day-to-day is to format tables following a specific process, you can record this process with the macro recorder (see the last section in this article for more detailed examples).

There’s an obvious advantage – apart from saving you tons of manual work – and it’s that Google Sheets macros can help you focus on higher-value tasks for your business. For example, you can use macros to automate advanced analysis or develop complex formulas. By recording tasks such as filtering or formatting data input, you’ll also be able to deliver more accurate and consistent information.

The macro recorder is a Google Sheets feature. Google Docs and Google Slides don’t have one, so automating them means writing Apps Script yourself.

How to enable macros in Google Sheets

Google Sheets has no setting to enable macros. In Excel, security settings can block macros until you allow them, but in Google Sheets they work by default. The only thing you approve is a one-time authorization: the first time you run a macro, Google asks for permission to let its Apps Script code work with your spreadsheet. Steps 6 to 8 in the next section show those prompts.

Say a colleague has shared a spreadsheet with a recorded macro that speeds up table formatting. This is how to find and run it.

1. Open the Google Sheets containing the recorded macro and head over to Extensions > Macros.

Google Sheets macros — Extensions menu open with Record macro, Import macro, and Manage macros

2. You should see a list of macros. To run one, click on it.

Run a Google Sheets macro — recorded Sort by Last Name macro in the Macros submenu

Tip: If the macro has a shortcut number, you can also run it by pressing Ctrl + Alt + Shift and that number, for example Ctrl + Alt + Shift + 1. Our Google Sheets keyboard shortcuts guide lists many more.

If you don’t see a list of macros, the spreadsheet has no recorded macros yet. Let’s see how you can record your own macro in a few simple steps.

How to create macros in Google Sheets

1. Open a new Google Sheet and head over to Extensions > Macros > Record macro.

Create macros in Google Sheets — Record macro in the Macros submenu of Extensions

Tip: To create a Google Sheet without going into your Drive, type “sheets.new” into your browser. If you are in your Drive, you can press Shift + s.

2. In the box below, you’ll see two options: “Use absolute references” or “Use relative references”. If you intend to repeat the same calculation across multiple rows or columns, select the “Use relative references” option.

Record a Google Sheets macro — recording panel with Use relative references selected

Tip: Use absolute references if you want to apply the macro to new sets of data that have the same range location every time you run it. Relative references are more commonly used when you need to apply formulas to cells. Take into account that the macro will apply to the cell where your cursor is at that moment.

3. The macro recorder will show every action you take. Once you’ve finished your task, click “Save”.

Record a Google Sheets macro — Save button in the Recording new macro panel

4. In the “Save new macro” dialog box, provide a name. Optionally, you can enter a number from 0-9 to create your own shortcut to run that macro. Click “Save” to finish.

Google Sheets macros — Save new macro dialog with a name and a Ctrl + Alt + Shift + 1 shortcut

5. Head over to Extensions > Macros. To run the macro, click on it.

Run a Google Sheets macro — Sort by Last Name macro with its shortcut in the Macros submenu

6. The first time you run a macro, Google Sheets asks for permission. Click “Continue”.

Enable macros in Google Sheets — Authorization Required dialog with the Continue button

7. Select the Google account you’d like to run this macro on.

Enable macros in Google Sheets — Choose an account window for the recorded macro

8. Click on “Allow” to confirm that you trust the recorded macro.

Enable macros in Google Sheets — Allow button to let the macro view and manage spreadsheets

How to edit, rename, or delete a macro

Every macro you record is saved as a function in the spreadsheet’s Apps Script project. To manage your macros, go to Extensions > Macros > Manage macros. There you can rename a macro or change its shortcut number. Click the three-dot menu next to a macro and choose Edit script to open its code in Apps Script, or Remove to delete it from the Macros menu.

Removing a macro doesn’t delete its code. The function stays in the Apps Script project until you delete it there too.

How to use macros in Google Sheets: examples

So far, we’ve shown basic examples to illustrate how to enable and create Google Sheets macros. You can also build macros from code with Google Apps Script, the Google Sheets equivalent of Visual Basic for Applications (VBA) in Excel. Don’t worry! There are ready-made codes for repeatable tasks, so you still don’t need to learn a single line of code.

Example 1: sort all your sheets alphabetically

If your spreadsheet has many named tabs, this code puts them in alphabetical order. For more ways to handle tabs, see how to work with multiple sheets.

1. Open Google Sheets and go to Extensions > Apps Script.

Google Sheets macros with Apps Script — Apps Script in the Extensions menu

2. A new tab will open in your browser. Copy and paste the following code onto a new line:

// sort sheets alphabetically
function sortSheets() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var sheets = spreadsheet.getSheets();
  var sheetNames = [];
  sheets.forEach(function(sheet, i) {
    sheetNames.push(sheet.getName());
  });
  sheetNames.sort().forEach(function(sheet, i) {
    spreadsheet.getSheetByName(sheet).activate();
    spreadsheet.moveActiveSheet(i + 1);
  });
}
Google Sheets macros with Apps Script — sortSheets function pasted in the editor

3. Don’t forget to save the script by clicking on the disk icon, as shown below.

Google Sheets macros with Apps Script — Save project icon in the editor toolbar

4. Back in your spreadsheet, go to Extensions > Macros > Import macro to import this function as a macro.

Tip: If Import macro is greyed out, Google Sheets hasn’t found a function it can import. Functions already in the Macros menu don’t count. Save the script, reload the spreadsheet, and try again.

Import a Google Sheets macro — Import macro in the Macros submenu of Extensions

5. Click on “Add Function” to add to your list of macros.

Import a Google Sheets macro — Import dialog with sortSheets and Add Function

6. Go to Extensions > Macros and click on the macro you just imported.

Google Sheets macros example — imported sortSheets macro in the Macros submenu

7. Google Sheets will automatically sort your sheets in alphabetical order, as shown below.

Google Sheets macros example — sheet tabs sorted as Alkai, Brad, Roberts, Smith

That’s it: you’ve turned an Apps Script function into a Google Sheets macro.

Example 2: reset all filters

Filters are commonly used to visualize and interpret your data better and more clearly. However, not everyone in your team might be interested in your filtering and need to remove these every time you share the data. This macro clears them in one go. If teammates need their own view of the same data, filter views let each person filter without affecting other users.

1. Open Google Sheets and go to Extensions > Apps Script.

2. A new tab will open in your browser. Copy and paste the following code onto a new line:

// reset all filters for a data range on current Sheet
function resetFilter() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = sheet.getDataRange();
  range.getFilter().remove();
  range.createFilter();
}
Google Sheets macros example — resetFilter function in the Apps Script editor

3. Follow steps 3-6 from the previous example.

Like before, as soon as you run the macro, Google Sheets will automatically reset any filter you created in a matter of seconds.

Conclusion

While Excel offers powerful features to automate tasks, including Power Automate or Power Query, Google Sheets macros now also provides powerful automation features. On top of this, Google Apps Script is the equivalent of VBA in Excel and has unlocked a greater range of tasks that can help you speed up more complex tasks.

You should now know what Google Sheets macros are, why the only thing to enable is a one-time authorization, and how to record and run your own. You should also feel ready to start using Apps Script to create functions and import them to run as Google Sheets macros.

A macro works inside one spreadsheet. When the same data has to move between files, Sheetgo, an AI-powered data automation platform, connects your spreadsheets and keeps them up to date on a schedule. For more ways to save time, read our 10 tips and tricks to maximize Google Sheets.

You may also like…

google sheets features and formulas

Top 5 dynamic array formulas in Google Sheets 

Google Sheets has evolved beyond basic spreadsheets. With the introduction of dynamic array formulas, users can now manipulate and analyze...
google sheets features and formulas

Mastering the FILTER Formula: 4 Use Cases with Examples

The FILTER formula in Google Sheets is a versatile tool for extracting data that meets specific conditions. Unlike the QUERY formula,...
google sheets features and formulas

Unlocking the Power of SUMIF and SUMIFS in Google Sheets: 4 real-life use cases

The SUMIF and SUMIFS formulas in Google Sheets are indispensable tools for performing conditional summations. They simplify complex...