Permission & Access Issues

How to Unlock an Excel File in SharePoint Online Before Uploading

Steven ParkerSteven Parker Oct 26, 2026 868 views

Question details

A console application fails to replace or upload an Excel file to SharePoint Online because the file is locked by a user who left the workbook open during a co-authoring session.

How to Unlock an Excel File in SharePoint Online Before Uploading
Product
Microsoft Excel / SharePoint Online
Device & OS
not provided
Scenario
Automating file uploads or replacing an existing Excel file in a SharePoint document library using a console application.
Observed behavior
The upload fails with a locked-file message because another user currently has the file open in an active SharePoint session.
Before you start

Ensure you have SharePoint Administrator or Global Administrator privileges if you need to force-close active user sessions or configure tenant-wide idle sign-out policies.

Solution 1Recommended

Enable Idle Session Sign-out in SharePoint Admin Center

Automatically sign out users who leave their workbooks open after a period of inactivity to prevent file locks.

This is a proactive approach. By configuring idle session sign-out, SharePoint will automatically close inactive sessions, releasing the locks on co-authored Excel files so your automated applications can overwrite them without manual intervention.

1
Access SharePoint Admin Center

Log in to the Microsoft 365 admin center with administrator credentials and navigate to the SharePoint admin center.

2
Navigate to Access Control

In the left-hand navigation menu, click on 'Policies' and then select 'Access control'.

3
Configure Idle Session Sign-out

Click on 'Idle session sign-out'. Turn on the feature by toggling the switch.

4
Set Inactivity Duration

Specify the period of inactivity (e.g., 1 hour) before users are automatically signed out. Save your changes.

Enable Idle Session Sign-out in SharePoint Admin Center
Policy Application Delay: It may take a short amount of time for the idle sign-out policy to propagate across your tenant and begin terminating inactive sessions.
Free Microsoft Office alternative

Try WPS Office for Seamless Spreadsheet Management

If you are looking for a reliable, lightweight, and cost-effective office suite, WPS Office provides excellent spreadsheet editing capabilities. It is fully compatible with Microsoft Excel formats and offers a familiar interface, making it easy to manage your data locally or collaborate via WPS Cloud without complex SharePoint locking issues.

  1. 1. Download and Install: Visit the official WPS Office website to download the free installation package.
  2. 2. Open WPS Spreadsheets: Launch the application and open your existing .xlsx files directly without any formatting loss.
  3. 3. Utilize Cloud Features: Sign in to your WPS account to save files to WPS Cloud for real-time collaboration and automatic backups.
Fully compatible with Microsoft Excel (.xlsx, .xls, .csv) formats.Built-in cloud collaboration with easy file sharing and version history.Lightweight installation with fast loading times for large spreadsheets.Free to use with a highly familiar tabbed user interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why does a console application fail to upload an Excel file to SharePoint?

The upload fails if a user has the target Excel file open in a co-authoring session, causing SharePoint to lock the file to prevent conflicts. The application cannot overwrite it until the user's session is completely closed.

Does closing the browser tab immediately unlock the Excel file in SharePoint?

Not always. Sometimes the co-authoring session remains active in the background for a short period. Refreshing the library or waiting a few minutes usually clears the lock.

Can standard users unlock an Excel file left open by someone else?

No, standard users cannot force-close another user's active session. However, if the file is manually checked out rather than just open, a Site Owner or Administrator can override or discard the checkout.

How do I prevent users from accidentally locking files via co-authoring?

You can ask administrators to configure 'Idle session sign-out' in the SharePoint admin center, which automatically logs users out and releases their files if they are inactive for a set duration.