Access Excel 365 sheet
Tags: #excel365 #snippet
Author: Ebin Paulose

Input

Import sharepoint connector

1
try:
2
import sharepoint_connector
3
except:
4
!pip install sharepy
5
import sharepoint_connector
Copied!

Set variables

  • username - username of sharepoint account
  • password - password of sharepoint account
  • domain - domain of sharepont account (eg mysite.sharepoint.com)
  • path - its a full path of file in sharepoint . it can get from sharepoint dashbord by right click on file and select detail. then path can copy from right panel in dashboard
  • sheet - name of sheet
  • export - it is an optional parameter. it can be csv or xlsx. file will be exported to data_output folder based on this variable. set export as empty string or False if no need to export the file
1
password="9aXgzH2DRqKCCU8z"
2
3
domain = "cashstory.sharepoint.com"
4
path = "https://cashstory.sharepoint.com/sites/cashstory-external/Documents%20partages/CashStory%20Forecasting%20Module/Forecast.xlsx"
5
sheet = "Forecast"
6
export = "xls"
Copied!

Model

Connect to sharepoint with the variables

1
df = sharepoint_connector.connect(username, password, domain, path, sheet, export)
Copied!

Output

Display result

1
df
Copied!
Copy link
Edit on GitHub