What are macros in Google Sheets?

A macro records your clicks and keystrokes in Google Sheets, then saves them as an Apps Script function you can run again from the Extensions menu or a keyboard shortcut. Macros are the fastest on-ramp to automation when your task is a fixed sequence of formatting or edits.

When to use it

Use macros to repeat the same steps: apply a header style, delete blank rows in a known layout, insert a standard tab, or run a predictable cleanup on exported data every Monday.

When to skip it

Skip macros when the layout changes often, when you need branching logic per row, or when formulas and conditional formatting can stay dynamic without a recording.

How it works

  1. 1

    Choose Extensions > Macros > Record macro and pick absolute or relative cell references.

  2. 2

    {:"Perform your steps"=>"format, sort, paste values, insert rows. Sheets captures each action."}

  3. 3

    Save the macro with a name and optional shortcut (Ctrl+Alt+Shift+number on desktop).

  4. 4

    Sheets stores the macro as a function in the bound Apps Script project you can edit later.

  5. 5

    Run it from Extensions > Macros or the shortcut when the sheet layout matches what you recorded.

  6. 6

    Open the script to replace fragile UI steps with getValues loops for more stable production use.

Examples in Google Sheets

Weekly report cleanup

Record deleting rows where column A is blank, freezing row 1, and setting number format on column C. Run before sharing the tab with leadership.

Brand header styling

Record bold white text on a navy background for A1:F1, then assign a shortcut for new client tabs.

Export prep macro

Record copy-paste values only on a data range before downloading CSV so formulas do not leak downstream.

Build this without starting from a blank cell

Use a Better Sheets tool for Google Sheets macros, then watch a walkthrough when you want the full pattern.

Better Sheets resources

Common mistakes

  • Recording with absolute references when you meant relative, so the macro edits the wrong cells next time.
  • Assuming a macro works after someone inserts a column in the middle of the recorded range.
  • Running macros on protected ranges without testing as a non-owner editor.
  • Treating recorded macros as secret; anyone with script access can read what they do.
  • Re-recording the same macro ten times instead of editing the generated function once.

Frequently asked questions

Where are macros stored?
In the spreadsheet-bound Apps Script project under Extensions > Apps Script, as named functions.
Can I edit a macro?
Yes. Open Apps Script and change the generated function like any other script.
Macros vs Apps Script?
Macros are recorded Apps Script. Hand-written script is better for loops, APIs, and triggers.
Do macros run on mobile?
Keyboard shortcuts and macro menus are limited on mobile. Plan desktop for macro-heavy workflows.
Can macros call onEdit?
Macro steps may trigger edit events depending on what they change. Test if you have onEdit handlers.
How many macros can I save?
Google allows multiple saved macros per file; organize names clearly so teammates pick the right one.
Can viewers run macros?
Usually not. Macros typically require edit access to change the sheet.
Relative vs absolute recording?
Relative moves with your active cell when the macro runs. Absolute always targets the same addresses.

Related Tutorials

Watch how Google Sheets macros works

Browse more tutorials
How to Record Macros

How to Record Macros

Record a macro, to Insert a column every day.
How to Edit a Macro

How to Edit a Macro

Editing macros in Google Sheets helps you do more in less time.
How to Trigger Macros Daily

How to Trigger Macros Daily

Automate your apps script and macros you can record.
Wrap Your Mind Around This - Learn to Code in Google Sheets Part 6

Wrap Your Mind Around This - Learn to Code in Google Sheets Part 6

this completes learn to code in Google Sheets and I wanted to finish off...

Related glossary terms

Done reading about Google Sheets macros?

Membership unlocks 636+ tutorials, unlimited generators, and every template. Practical lessons. Zero fluff.

Need this once

Jump to a free tool or a single tutorial for this topic.

Learning Sheets for real

Unlock the full library, generators, and templates with membership.