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
Choose Extensions > Macros > Record macro and pick absolute or relative cell references.
-
2
{:"Perform your steps"=>"format, sort, paste values, insert rows. Sheets captures each action."}
-
3
Save the macro with a name and optional shortcut (Ctrl+Alt+Shift+number on desktop).
-
4
Sheets stores the macro as a function in the bound Apps Script project you can edit later.
-
5
Run it from Extensions > Macros or the shortcut when the sheet layout matches what you recorded.
-
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.
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
Wrap Your Mind Around This - Learn to Code in Google Sheets Part 6
Related terms
onOpen trigger
The onOpen trigger runs an Apps Script function automatically when someone opens the spreadsheet. It is the standard way to add custom menus, show instructions, or refresh lightweight cache without asking the user to run a macro first. Name the function onOpen or bind it as an installable open trigger.
Read guide →Script Editor
The Script Editor is the Apps Script workspace inside your spreadsheet where you write JavaScript that talks to Sheets, Gmail, and other Google services. You open it from Extensions > Apps Script. Every function you save can be run manually, bound to a trigger, or linked from a custom menu.
Read guide →Google Sheets automation
Automation means work happens without repeating the same clicks every day: imports update, emails send, rows move, and dashboards refresh. In Sheets, automation usually stacks built-in features, Apps Script, and sometimes the Sheets API or add-ons. Start with the lightest tool that still solves the job.
Read guide →cell formatting
Cell formatting controls how values display without necessarily changing the stored value underneath. Currency, percent, date, and plain text formats keep reports readable and prevent Sheets from auto-converting IDs into dates. Good formatting is the difference between a sheet leadership trusts and one they argue with.
Read guide →Done reading about Google Sheets macros?
Membership unlocks 600+ 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.