How to Fix Excel Macro-Free File Error When Importing a Google Sheet
Question details
The user encounters a macro-free file error in Excel when opening an XLSX file exported from Google Sheets, preventing the file from functioning normally.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Opening an exported Google Sheets XLSX file in Excel that contains custom Apps Script functions or embedded scripts.
- Observed behavior
- Excel displays a warning that the XLSX file is macro-free but contains macro-enabled content, triggering an error due to incompatible scripts.
Before exporting the file from Google Sheets, identify any cells that rely on custom Apps Script functions, as these scripts cannot be executed natively within Excel and will need to be replaced.
Remove Custom Functions in Google Sheets and Recreate in Excel
Google Sheets custom functions written in Apps Script are incompatible with standard Excel files. You must replace them with standard formulas or recreate them using Excel VBA.
Because Google Apps Script uses JavaScript and Excel macros use VBA, there is no direct compatibility between the two automation systems. Excel flags the imported Apps Script content as an unsupported macro within a standard (.xlsx) file, causing the error.
Open your original workbook in Google Sheets and locate any cells that use user-defined functions created via Extensions > Apps Script.
If the custom function results do not need to be dynamic in Excel, copy the cells containing the custom functions and use Edit > Paste special > Values only to replace the formulas with static text.
Click File > Download > Microsoft Excel (.xlsx) to export a clean version of the workbook without the active custom formulas.
Open the downloaded XLSX file in Excel. Press ALT + F11 to open the VBA Editor, click Insert > Module, and rewrite your custom function logic using standard VBA.
Go to File > Save As, and choose 'Excel Macro-Enabled Workbook (*.xlsm)' from the file format dropdown to properly support your new VBA functions.

Inspect and Remove Unsupported Embedded Content in Excel
If your Google Sheet did not contain custom functions but still triggers the error, the file may contain hidden named ranges or embedded web objects that Excel misinterprets as macros.
Handle Spreadsheets Seamlessly with WPS Office
Avoid complicated Microsoft Office compatibility errors and macro warnings. WPS Office provides a lightweight, highly compatible spreadsheet solution that perfectly supports standard XLSX formats, advanced formulas, and daily data management tasks without the heavy price tag.

Frequently Asked Questions
Why does my downloaded Google Sheet say it contains macros?
Google Sheets often utilize Apps Script for custom formulas, automated workflows, or embedded buttons. When you export the file to an XLSX format, Excel detects this underlying script and flags it as a macro, even though the file is saved as a macro-free (.xlsx) workbook.
Can I convert Google Apps Script directly to Excel VBA?
There is no built-in or automated way to convert Google Apps Script (which is based on JavaScript) directly into Excel VBA. You must manually rewrite the automation logic in VBA after importing the file into Excel.
How do I save a workbook with macros in Microsoft Excel?
To safely store and execute VBA macros in Excel, you cannot use the standard .xlsx extension. You must navigate to File > Save As, and select 'Excel Macro-Enabled Workbook (*.xlsm)' from the format dropdown menu.




