How to Fix Excel Ignoring Read-Only for XLSM Files on SharePoint
Question details
Excel ignores standard read-only commands and attributes when opening an XLSM file hosted on SharePoint, forcing it to open in edit mode.

- Product
- Microsoft Excel and SharePoint
- Device & OS
- not provided
- Scenario
- A user is attempting to open a macro-enabled workbook (XLSM) directly from a SharePoint environment in read-only mode using various methods like the /r switch or context-menu.
- Observed behavior
- Excel completely ignores the /r command-line switch, the read-only context-menu option, the 'Always Open Read-Only' setting, and the file's read-only attributes when the file is on SharePoint, although these work perfectly when stored locally.
Ensure you have proper access rights to the SharePoint site and check if the XLSM file is currently locked or checked out by another user, as server policies can override local application settings.
Verify SharePoint Library Checkout and File-Locking Policies
SharePoint's server-side document library settings dictate how files are opened, frequently overriding local Excel read-only commands.
When files are hosted on SharePoint, the server's collaboration and file-locking protocols take precedence over local Excel switches like '/r'. If the library is not configured to force a checkout, or if your user account has edit permissions, SharePoint may automatically push the file to Excel in edit mode.
Navigate to your SharePoint document library, click the Settings gear icon in the top right, and select 'Library settings'.
Click on 'Versioning settings' and scroll down to the 'Require Check Out' section. If this is set to 'No', multiple users can edit simultaneously, which can bypass local read-only preferences.
If you need the file to always be read-only for certain users, adjust the specific file's access permissions to 'View Only' directly within SharePoint rather than relying on Excel's local settings.

Download the XLSM File Locally
Since the read-only attributes work locally, downloading the file separates it from SharePoint's active sync and locking mechanisms.
Try WPS Office for Seamless Spreadsheet Management
If Microsoft Excel's integration with SharePoint is causing frustrating file-locking conflicts, consider WPS Office as a lightweight, free alternative. It offers high compatibility with Microsoft formats without complex server-side configuration overhead.
- 1. Download WPS Office: Visit the official WPS website to download and install the free office suite.
- 2. Open Your XLSM File: Launch WPS Spreadsheets and open your downloaded XLSM file to view its contents and macros.
- 3. Manage Read-Only Modes Easily: Use WPS Office's built-in file protection and read-only modes without interference from SharePoint sync protocols.

Frequently Asked Questions
Why does the /r switch work locally but not on SharePoint?
SharePoint uses specialized WebDAV and cloud sync protocols that bypass standard local command-line switches like /r. The application prioritizes the server's permission levels and checkout status over local parameters.
How do I force an XLSM file to open as read-only for all users?
The most reliable method is to configure the file's permissions directly within SharePoint. Share the file with 'View Only' permissions, or configure the document library to 'Require Check Out' to prevent accidental edits.
Does the 'Always Open Read-Only' Excel setting work with OneDrive?
This local application setting is frequently overridden by Microsoft 365's AutoSave and collaborative co-authoring features when files are hosted on cloud platforms like SharePoint or OneDrive.




