SharePoint Document Issues

Save an Excel Workbook as an XLSM File in a SharePoint Document Library

Chanuka GeekiyanageChanuka Geekiyanage Nov 12, 2026 870 views

Question details

Save a workbook containing VBA code and PivotTables as an Excel Macro-Enabled Workbook (.xlsm), then store the completed file in a SharePoint document library.

Save an Excel Workbook as an XLSM File in a SharePoint Document Library
Product
Microsoft Excel and SharePoint document library
Device & OS
not provided
Scenario
The user has added VBA code and PivotTables to a workbook and needs to retain the macros when saving or uploading the file to SharePoint.
Observed behavior
The required outcome is a SharePoint-stored .xlsm file that preserves the workbook's VBA project and PivotTables.
Before you start

Open the workbook in the Excel desktop app rather than Excel for the web, because browser editing cannot create or edit VBA code. Confirm that you have permission to upload files to the target SharePoint library and that the library accepts .xlsm files.

Solution 1Recommended

Save the workbook as an XLSM file directly to SharePoint from Excel

Use this method when the SharePoint library is available as a save location in the Excel desktop app.

The XLSM format preserves VBA macros, worksheets, and PivotTables. Do not save the macro workbook as .xlsx, because that format removes the VBA project.

1
Open the workbook in the desktop app

In the SharePoint document library, select the workbook, then choose Open in Desktop App to open it in Microsoft Excel.

2
Choose Save As

In Excel, select File > Save As, then select the SharePoint site or the document library location where you want to store the completed workbook.

3
Select the macro-enabled format

In the Save as type list, choose Excel Macro-Enabled Workbook (*.xlsm). Enter a file name that ends in .xlsm if Excel does not add the extension automatically.

4
Save and verify the uploaded file

Select Save, then return to the SharePoint document library and confirm that the new .xlsm file appears. Open it in the desktop app to verify that the VBA code and PivotTables are present.

Save the workbook as an XLSM file directly to SharePoint from Excel
Macro security: Users may see a security warning when opening an XLSM file. They should enable macros only when the file is from a trusted source and the VBA code is expected.
Work with macro-enabled spreadsheets

Save an XLSM Workbook and Upload It to SharePoint with WPS Office

WPS Office Spreadsheet can help you open a compatible macro-enabled workbook, save a copy in XLSM format, and upload the finished file to your SharePoint library through the browser. Review macro behavior in the desktop application before sharing the workbook with others.

  1. 1. Open the workbook in WPS Spreadsheet: Launch WPS Office, select Open, and choose the workbook you downloaded from SharePoint or saved locally.
  2. 2. Review workbook content: Check the worksheets and PivotTables in WPS Spreadsheet, and confirm that the required workbook data is ready before saving a new copy.
  3. 3. Save as an XLSM file: Select Menu > Save As, choose a local destination, select Excel Macro-Enabled Workbook (*.xlsm) if available, and select Save.
  4. 4. Upload the completed workbook: Open the SharePoint document library in your browser, select Upload > Files, and choose the saved .xlsm workbook.
Save compatible workbooks in Excel Macro-Enabled Workbook (.xlsm) format.Keep PivotTables and spreadsheet data in an Excel-compatible workbook.Open and edit Microsoft Excel formats including XLSX, XLS, and XLSM.Use a lightweight, familiar spreadsheet workspace for everyday workbook editing.
microsoft office alternative - wps office

Frequently Asked Questions

Why must I save a workbook with VBA code as XLSM instead of XLSX?

The XLSX format cannot retain a VBA project. In Excel desktop, use File > Save As and select Excel Macro-Enabled Workbook (*.xlsm) to preserve VBA code.

Can I create or edit VBA macros in Excel for the web?

No. Open the workbook through Open in Desktop App and use the Excel desktop application for VBA work, then save the file as .xlsm.

Will SharePoint allow me to upload an XLSM workbook?

Usually it can, but a site administrator may configure library policies that restrict macro-enabled files. If Upload > Files rejects the workbook, ask the library owner to review the file-type or security policy.

Do PivotTables remain available after saving as XLSM?

Yes. Saving as Excel Macro-Enabled Workbook (*.xlsm) preserves PivotTables as well as the workbook's VBA project, worksheets, and formulas.

Can users run macros from an XLSM file stored in SharePoint?

Users generally need to open the file in the Excel desktop app and may receive a macro security warning. They should enable macros only if they trust the workbook and its source.