Can Google Sheets Run Excel Macros? Key Differences

VBA & macros · Updated November 3, 2026

Can Google Sheets Run Excel Macros? Key Differences

No. Google Sheets cannot run Excel VBA macros. It has its own automation tools—Google Apps Script and a macro recorder—but Excel macros must be rewritten or replaced before they can work in Sheets.

Why Excel macros do not run in Google Sheets

Excel macros are commonly written in Visual Basic for Applications (VBA), Microsoft’s automation language for Excel. A VBA macro uses Excel’s object model: its instructions refer to workbooks, worksheets, ranges, charts, and other Excel features. Google Sheets is a different application with a different automation system, so it does not interpret VBA code or provide the same Excel object model.

This difference remains even when a workbook is stored in Google Drive or opened through Sheets. A file extension such as .xlsm identifies an Excel macro-enabled workbook; it does not make its VBA code executable in Google Sheets. Opening or converting a workbook may allow you to work with its cell data, but it does not turn the embedded VBA into a working Sheets macro.

It helps to distinguish a spreadsheet file from its automation. Values and many formulas may transfer between applications, while code, buttons, forms, and application-specific features may not. A workbook can therefore look mostly familiar in Sheets while its automated workflow is unavailable.

What Google Sheets offers instead

Google Sheets provides Google Apps Script, a cloud-based scripting platform that uses JavaScript. Scripts can read and change spreadsheet data, create menus, send email, and interact with other Google services, subject to permissions and service limits. Apps Script is not a VBA interpreter: a VBA procedure cannot simply be pasted into the Apps Script editor and expected to work.

For simpler workflows, Sheets also has a built-in macro recorder. In a Google Sheets browser session, choose Extensions > Macros > Record macro, perform supported actions, and save the recording. Sheets generates an Apps Script function for those actions. You can later run it from Extensions > Macros or inspect and edit its code through Extensions > Apps Script.

The recorder can be useful for repetitive formatting or straightforward data operations, but it captures Sheets actions, not Excel VBA. It may not reproduce complex branching, external connections, custom forms, or workflows that rely on Excel-only features. A recorded macro is a starting point, not proof that a larger Excel process has been converted completely.

What can transfer—and what usually needs rebuilding

When planning a move, separate the workbook’s data and calculations from its automation. Basic tables and many common formulas are often portable, though formulas, formatting, and features should be checked in the converted file. VBA procedures, UserForms, ActiveX controls, Excel-specific add-ins, and automation tied to Windows programs do not become Apps Script features automatically.

For example, an Excel macro that colors overdue rows might be recreated as a Sheets macro or with conditional formatting, depending on whether it needs to perform an action or merely display a visual cue. A routine that loops through records, checks several conditions, and emails a report may need a custom Apps Script design. A macro that controls Outlook, accesses a local folder, or calls an Excel add-in may require a different workflow or may be a reason to keep the process in Excel.

Before estimating the work, list what each macro actually does and what it depends on. Include how it starts, which sheets and ranges it changes, whether it reads or writes files, and whether a person reviews its output. This inventory often reveals that a short-looking macro depends on several Excel-specific systems.

How to move a macro-driven workflow to Sheets

A careful migration starts with a backup and a clear description of the required result, rather than with a blind file conversion. Use this sequence to assess the work:

  1. Keep an untouched copy. Save the original .xlsm workbook somewhere safe. Do not rely on a converted copy as the only version of a macro-enabled file.
  2. Inventory the automation. Record each macro’s purpose, inputs, outputs, triggers, and dependencies. Note any buttons, forms, add-ins, external files, or applications it uses.
  3. Separate essential steps from incidental ones. Some recorded actions may be replaceable with built-in Sheets features, formulas, filters, or conditional formatting. Other steps need a script or a different application.
  4. Choose a Sheets implementation. Use the macro recorder for simple repeatable actions, or Apps Script for custom logic and integrations that are supported by Google’s services.
  5. Test with representative copies. Check normal cases, blank cells, unusual values, large inputs, and any permissions or email behavior. Compare the result with the Excel workflow before relying on it.

For a small macro, rewriting may be straightforward. For a large workbook with many procedures and dependencies, estimate migration as a software project: document requirements, rebuild the necessary behavior, test it, and plan for maintenance. Matching the original outcome matters more than translating each line of VBA one by one.

Choosing between Sheets, Excel, and a hybrid workflow

Sheets can be a good fit when people need browser-based collaboration, the workbook’s automation is modest, and the required services are available in Apps Script. Excel is usually the practical choice when the workflow depends on VBA, desktop integrations, specialized add-ins, or features that Sheets does not provide. The decision is about the whole process—not simply whether the spreadsheet’s cells can be opened elsewhere.

  • Choose Sheets when simultaneous online editing and Google Workspace integration matter, and you can replace the automation with supported Sheets features or Apps Script.
  • Stay with Excel when existing VBA is business-critical, relies on Windows or Office integrations, or would be costly or risky to reproduce.
  • Consider a hybrid setup when some information is useful in Sheets but the macro-dependent process must remain in Excel. Define how data moves between the tools and who owns the authoritative copy.

Do not assume a hybrid arrangement means Sheets can launch an embedded VBA macro. An external integration might pass data to another service or application, but that is a separately designed connection, not native VBA execution in Sheets. It can introduce additional security, access, reliability, and maintenance requirements.

Common conversion problems and how to avoid them

A frequent surprise is that a workbook opens and its data appears intact, leading someone to assume the macros came along. Test the actual automated steps, not just the appearance of the sheets. If a button stops working, it may be tied to a VBA procedure or Excel control that Sheets does not support.

Another problem is assuming that similar-looking code is interchangeable. VBA uses Excel-specific objects and methods; Apps Script uses its own classes and services. Even simple operations need to be expressed using the target application’s APIs. A direct translation can also miss differences in date handling, formula behavior, permissions, or how users trigger a process.

To reduce risk, test on copies and compare outputs against known examples. Check formulas and named ranges after conversion, verify any external data connections separately, and make sure users know which file is authoritative. If a workflow sends messages or changes shared data, test with non-production recipients and data before enabling it for everyday use.

Permissions, security, and ongoing maintenance

Apps Script may ask users to authorize access to a spreadsheet or other Google services when a script runs. The permissions depend on what the script does. A function that only edits the current spreadsheet has a different scope from one that sends email or accesses files. Users should review authorization prompts and only run scripts from sources they trust.

Scripts also have execution and service quotas, which can vary by account type and Google’s current policies. A script that works on a small sheet may be slow or hit limits with much larger data or frequent triggers. Review the current Apps Script quotas and limitations for the account in use before designing a critical or high-volume process.

Like any automation, a Sheets script needs an owner, documentation, and periodic checks. A person’s departure, a changed spreadsheet layout, altered permissions, or an external service change can break a workflow. Build in clear error handling and decide who will respond when an automated task fails.

Frequently Asked Questions

Can I open an XLSM file in Google Sheets?
Sheets can work with Excel files in supported workflows, but opening or converting an .xlsm file does not make its VBA macros run. Keep the original workbook as a backup and verify which workbook features survive any conversion or export.

Can Google Sheets convert VBA to Apps Script automatically?
No general automatic conversion turns arbitrary VBA into working Apps Script. Sheets’ macro recorder creates Apps Script from actions recorded in Sheets; it does not translate an existing Excel macro. VBA logic usually needs to be reviewed and rebuilt.

Is Apps Script the same as VBA?
No. Apps Script uses JavaScript and Google’s services, while VBA is Microsoft’s automation language for Office applications. Both can automate spreadsheet tasks, but their syntax, available features, permissions, and application interfaces differ.

Can I use a Google Sheets macro offline?
Apps Script runs through Google’s services, so it is not a way to execute a VBA macro offline in a desktop copy of Sheets. Availability of spreadsheet editing offline is separate from whether a cloud script or trigger can run.

Will my Excel macro still work if I download the sheet back to Excel?
Do not assume it will. A Sheets-created or converted file may not contain the original VBA in usable form. Preserve the original .xlsm file separately, and test any exported workbook in Excel before depending on its macros.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.