cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Downloading sharepoint lists using python

tanjil
New Contributor III

Hello,

I am trying to download lists from SharePoint into a pandas dataframe. However I cannot get any information successfully. I have attempted many solution mentioned in stackoverflow. Below is one of those attempts:

# https://pypi.org/project/sharepoint/
 
 
from sharepoint import SharePointSite, basic_auth_opener
  
server_url = "https://teamup.<company_name>.com/"
site_url = server_url + "sites/pt/service/metrics/sitedata/"
opener = basic_auth_opener(server_url, username, password)
site = SharePointSite(site_url, opener)

When the following code is executed I am getting an error:

for sp_list in site.lists:
    print(sp_list.id, sp_list.meta['Title'])

Error generated:

<urlopen error [Errno -2] Name or service not known>

Any help on this issue is greatly appreciated.

Thanks in advance,

Tanjil

1 ACCEPTED SOLUTION

Accepted Solutions

tanjil
New Contributor III

Hello,

I have gotten the code to work by using office365 library instead.

View solution in original post

9 REPLIES 9

Hubert-Dudek
Esteemed Contributor III

Please use sharepy https://pypi.org/project/sharepy/ sharepoint library which you are using wasn't updated since 2015.

Alternative way is to use Azure logic apps and from there save it to Azure Data Lake Storage in format of your choice.

tanjil
New Contributor III

Thank you Hubert for your answer.

However, when running the following line:

s = sharepy.connect(SPUrl,username,password)

I am getting the following error:

'NoneType' object has no attribute 'group'.

Nice one, but if I found it earlier, it will be very helpful for me. But I want to know that I again want to perform migration due to my organizations merges with another. I have a lot of data in list. So, I can use this method or should I go with the professional tool such as SharePoint Migration Tool by SysTools.

User16725394280
Contributor II

Hi ,

Can you check on the below reference documentation and let us know whether it is helpful.

https://docs.microsoft.com/en-us/azure/data-factory/connector-sharepoint-online-list?tabs=data-facto...

Hi @tanjil​ ,

Did you check @Kiran Bharathi​ docs? do you still need help?

User16725394280
Contributor II

Hi Tanjil,

Kindly check and update us in case you have any further queries on this.

tanjil
New Contributor III

Hello,

I have gotten the code to work by using office365 library instead.

jessykoo32
New Contributor II

Hello tanjil,

I am new here and I need that code Please Help me. MyAccountAccess Rewards

huntaccess
New Contributor II

The error "<urlopen error [Errno -2] Name or service not known>" suggests that there's an issue with the server URL or network connectivity. Double-check the server URL to ensure it's correct and accessible. Also, verify that your network connection is stable and that there are no firewall or proxy settings blocking the connection to SharePoint. If the issue persists, consider reaching out to your IT department or SharePoint administrator for assistance. MyAccountAccess

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group