Lesen xlsx gespeichert, die auf sharepoint-Standort mit openpyxl in python?

schnell ein.

Ich habe XLSX-Datei, die sich auf sharepoint-Laufwerk und öffnen können, die es mit openpyxl in python, es funktioniert gut, wenn es gespeichert ist auf meinem lokalen Laufwerk.

Habe ich versucht, diese.

from openpyxl import load_workbook
wb = load_workbook('https://content.potatocompany.com/workspaces/PotatoTeam/Shared Documents/XYZ errors/XYZ Errors_Confirm.xlsx')

Wirft diese exception:

C:\Anaconda\lib\site-packages\openpyxl\reader\excel.py in load_workbook(filename, use_iterators, keep_vba, guess_types, data_only)
    123     except (BadZipfile, RuntimeError, IOError, ValueError):
    124         e = exc_info()[1]
--> 125         raise InvalidFileException(unicode(e))
    126     wb = Workbook(guess_types=guess_types, data_only=data_only)
    127 

InvalidFileException: [Errno 22] invalid mode ('rb') or filename: 'https://...

Bin ich etwas fehlt?
Ich brauche zum Lesen der Inhalte eines der Blätter in python.


EDIT:

Mit crussell die Ratschläge, die ich erhalten 401 UNAUTHORIZED:

import requests
import urllib
from openpyxl import load_workbook
from requests.auth import HTTPBasicAuth

file = "https://content.potatocompany.com/workspaces/PotatoTeam/Shared Documents/XYZ errors/XYZ Errors_Confirm.xlsx"

username = 'PotatoUser'
password = 'PotatoPassword'

resp=requests.get(file, auth=HTTPBasicAuth(username, password))
print(resp.content)

Scheint, wie sharepoint und Anfragen sind nicht kompatibel, die sowohl mit Digest-Authentifizierung und Standardauthentifizierung
http://docs.python-requests.org/en/latest/user/authentication/

InformationsquelleAutor Gunay Anach | 2015-12-10
Schreibe einen Kommentar