Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple SharePoint resources - only one accessible via xlwings #2427

Open
tstone-1 opened this issue Apr 9, 2024 · 0 comments
Open

Multiple SharePoint resources - only one accessible via xlwings #2427

tstone-1 opened this issue Apr 9, 2024 · 0 comments

Comments

@tstone-1
Copy link

tstone-1 commented Apr 9, 2024

OS (e.g. Windows 10 or macOS Sierra)

Tested with Windows 10 and Windows 11

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

xlwings 0.31.1, Excel Version 2401, Python 3.12.2

Describe your issue (incl. Traceback!)

I have multiple SharePoint document repositories synchronized.
C:\Users\MYUSERNAME\MYCOMPANYNAME\SITE 1 - Documents
C:\Users\MYUSERNAME\MYCOMPANYNAME\SITE 2 - Documents

PS C:\Users\MYUSERNAME\OneDrive - MYCOMPANYNAME\ecotools> & C:/Users/MYUSERNAME/AppData/Local/Programs/Python/Python312/python.exe "c:/Users/MYUSERNAME/OneDrive - MYCOMPANYNAME/ecotools/test223232.py"
Traceback (most recent call last):
  File "c:\Users\MYUSERNAME\OneDrive - MYCOMPANYNAME\ecotools\test223232.py", line 10, in <module>
    wb = xw.Book(resource2)
         ^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\xlwings\main.py", line 919, in __init__
    wb.fullname.lower() == fullname.lower()
    ^^^^^^^^^^^
  File "C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\xlwings\main.py", line 1173, in fullname
    return self.impl.fullname
           ^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\xlwings\_xlwindows.py", line 903, in fullname
    return fullname_url_to_local_path(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\xlwings\utils.py", line 599, in fullname_url_to_local_path
    return search_local_sharepoint_path(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSERNAME\AppData\Local\Programs\Python\Python312\Lib\site-packages\xlwings\utils.py", line 741, 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!)

Running the following code works fine with resource1, but not with resource2.

import xlwings as xw
import os

resource1 = rf'{os.path.expanduser('~')}\MYCOMPANYNAME\SITE 1 - Documents\document1.xlsx'
resource2 = rf'{os.path.expanduser('~')}\MYCOMPANYNAME\SITE 2 - Documents\document2.xlsx'

# Connect to the Excel file
wb = xw.Book(resource2)

# Access the desired sheet
sheet = wb.sheets['Sheet1']

# Read the data from the sheet
data = sheet.used_range.value

Next, I've added a user-scope variable SHAREPOINT_WIN of value %USERPROFILE%\MYCOMPANYNAME\SITE 2 - Documents\ - after restarting all applications and re-running, the issues remains to be the same. Any help is greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant