Excel CELL Filename Returns a SharePoint URL Instead of a Local Path
Question details
The user needs a reliable way to use a local path when Excel identifies a synchronized workbook by its SharePoint or OneDrive URL.

- Product
- Microsoft Excel
- Device & OS
- Windows
- Scenario
- A workbook is stored in a local folder synchronized with OneDrive or SharePoint, and a formula or automation needs its file location.
- Observed behavior
- CELL("filename",$A$1) returns a SharePoint or OneDrive URL instead of the expected Windows file path.
Save the workbook and check whether the file is available locally in File Explorer. Identify whether your import requires a Windows path or can use a SharePoint connection.
Use an Explicit Local Path for File Imports
Use this approach when an import or automation requires a Windows path and the file is available in a synchronized folder.
Excel may identify a synchronized workbook by its cloud URL. There is no reliable setting that forces CELL("filename") to return a local path in every situation.
Open File Explorer and browse to the workbook or source file in your OneDrive or SharePoint synchronized folder.
If the file is online-only, right-click it in File Explorer and select Always keep on this device. Wait for it to finish downloading.
In File Explorer, right-click the file and select Copy as path. Confirm that the copied value is a Windows path rather than a URL.
Paste the path into your import dialog, configuration cell, or script instead of deriving it from CELL("filename"). Remove any surrounding quotation marks if the destination does not accept them.

Connect the Import Directly to SharePoint
Use a SharePoint connection when the source files are stored in SharePoint and a local path is not required.
Work with Excel Files in WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open compatible Excel files and continue working with your spreadsheets without depending on Microsoft Excel; it does not change how Excel resolves synchronized workbook paths.

Frequently Asked Questions
Why does CELL return a SharePoint URL for a synced workbook?
Excel can identify a OneDrive-synchronized workbook by its cloud location, even when a copy is visible in a local synchronized folder. The returned location may vary by situation.
Can I force CELL("filename") to always return a Windows path?
There is no reliable Excel setting that forces a local path in every situation. Configure a local path explicitly or use a SharePoint-aware import instead.
Will the VBA FullName property always return a local path?
No. ThisWorkbook.FullName can also return a URL for a cloud-hosted workbook. Check the returned value and handle URLs and local paths separately rather than assuming it is a Windows path.
How can I find the local path of a synchronized file?
Find the file in its synchronized folder in File Explorer, right-click it, and select Copy as path. If the file is online-only, select Always keep on this device and wait for it to download first.




