Skip to content

Opening local file not possible while non synchronized SharePoint file is open in Excel #1946

@Roang-zero1

Description

@Roang-zero1

OS

Windows 10

Versions of xlwings, Excel and Python (e.g. 0.11.8, Office 365, Python 3.7)

  • xlwings: 0.27.10
  • Office 365
  • Python 3.9

Describe your issue (incl. Traceback!)

When I want to open a local file, but a Excel workbook from a non synchronized SharePoint is opened the local file cannot be opened.
When the non synchronized workbook is closed, xlwings works as expected.

This is problematic as the organization I am working with does not allow these workbooks to be synchronized to my computer, but I need the data from there for my xlwings integrated wokbook.

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\flask\app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\flask\app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\flask\app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\flask\app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "C:\Users\user\Documents\VersionControl\Zeiterfassung\web\views.py", line 87, in render_file
    workbook = xw.Book(workbook_path)
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\xlwings\main.py", line 823, in __init__
    wb.fullname.lower() == fullname
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\xlwings\main.py", line 1074, in fullname
    return self.impl.fullname
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\xlwings\_xlwindows.py", line 849, in fullname
    return fullname_url_to_local_path(
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\xlwings\utils.py", line 569, in fullname_url_to_local_path
    return search_local_sharepoint_path(
  File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\zeiterfassung-TMhrlkJT-py3.10\lib\site-packages\xlwings\utils.py", line 708, in search_local_sharepoint_path
    raise xlwings.XlwingsError(
xlwings.XlwingsError: Couldn't find your SharePoint file locally, see: xlwings.org/error

Include a minimal code sample to reproduce the issue (and attach a sample workbook if required!)

import xlwings as xw
from pathlib import Path

BASE_PATH = "C:\User\user\"
file_path = "book.xlsx"

workbook_path = Path(BASE_PATH, file_path)
print(os.fspath(workbook_path)) #C:\User\user\book.xlsx
workbook = xw.Book(workbook_path) #Error occurs here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions