How to upload a file to sharepoint site using python script

user3590460 picture user3590460 · May 16, 2014 · Viewed 36.1k times · Source

Is there a way to upload a file on sharepoint site using python script? I tried installing haufe.sharepoint, but it seems like it failed to fetch ntlm while it was installing, and I can't even use the connector module without having ntlm installed.

I've also tried just saving the excel file to the server location (so save it to directory like \server\sharepointsite\files instead of connecting via the URL) using openpyxl, but it looks like the file remains checked out after the file is saved..

I would appreciate any help. Thanks!!

Answer

Calanas picture Calanas · Sep 23, 2014

haufe.sharepoint only works for sharepoint lists, but you probably need access to document libraries.

You should use Python Requests with the help of Sharepoint's REST API.

If your sharepoint site doesn't support BasicAuth I recommend the requests_ntlm package.

It didn't work for me due to other reasons, but maybe it helps you out a bit.