Introduction
SharePoint is a web-site based collaboration system that uses workflow applications, list databases, and other web parts and security features to empower business teams to work together. SharePoint also gives the company using the platform the ability to control access to the information and automate the workflow processes across business units.
In simpler words, SharePoint allows you to manage all of your corporate content, creation of websites, and the organization's intranets to keep your users informed on what is happening, creating business process automation to automate tedious and mundane tasks and build customized apps that can help to boost your team's productivity.
Problem Statement
Lately, I came across a problem while making a POC on Invoice automation where i had to extract data from an invoice and store it in a SharePoint list. The problem was that the Invoice Processing System that I built was made using Python and Django, so finding a way to achieve the task seemed difficult in the initial days. After doing some research and looking for some resources, I stumbled into a Python library called shareplum which helps you to interact with SharePoint using Python.
What is Shareplum?
Shareplum is an open-source python library that makes it easy to interact with SharePoint services. It handles all of the messy parts of dealing with SharePoint and allows you to focus on your business requirement and write clean code.
Installing Shareplum in Windows/Ubuntu
Open Command Prompt / Terminal, then execute the below-mentioned statement to install the package using pip,
pip install shareplum
Authentication
After installing the shareplum library, we need to connect to our SharePoint Server to access it and to perform our operations as per our business requirement. To allow our application to get access to SharePoint server, we need to provide the credentials to our application which it can use to establish a connection with SharePoint using shareplum:
Code
- from shareplum import Site
- from shareplum import Office365
- from shareplum.site import Version
- sharepointUsername = "[email protected]"
- sharepointPassword = "@123$"
- sharepointSite = "https://abc.sharepoint.com/sites/MySite"
- website = "https://abc.sharepoint.com"
- authcookie = Office365(website, username=sharepointUsername,
- password=sharepointPassword).GetCookies()
- site = Site(sharepointSite, version=Version.v2016, authcookie=authcookie)
Create a new item in our SharePoint List
Assuming that we already have a list in SharePoint to perform the various operations, we are going to have a look at the code to add a few new list items to our List present in our SharePoint site.
Code

Join the conversation! Your thoughts help the community grow.