Importing Excel Files from a Personal OneDrive in Python
OneDrive is Microsoft’s cloud file storage solution

Importing Excel files into python is very simple:

  1. Open the Excel file from the personal OneDrive. Go to File > Share > Embed.

    2020-11-08-excel-personal-onedrive-python-img01

  2. In the next Embed dialogue, click on Generate.

    2020-11-08-excel-personal-onedrive-python-img02

  3. In the Embed pane, refer to the Embed code box on the lower left-hand corner. Here you will find the embed iframe. Copy the iframe and paste it onto a text editor of your choice.

    2020-11-08-excel-personal-onedrive-python-img03

  4. Within the iframe, locate the values for resid and authkey.

     <iframe width="402" height="346" frameborder="0" scrolling="no" src="https://onedrive.live.com/embed?resid=YOURRESID&authkey=YOURAUTHKEY&em=2&wdAllowInteractivity=False&wdHideGridlines=True&wdHideHeaders=True&wdDownloadButton=True&wdInConfigurator=True"></iframe> 
    
  5. With these values, use pandas to read the file. Replace ‘YOURRESID’ and ‘YOURAUTHKEY’ with the values found in the previous step.

     import pandas as pd
    
     resid = 'YOURRESID'
    
     authkey = 'YOURAUTHKEY'
    
     url_excel = ('https://onedrive.live.com/download?'
                  + 'resid=' + resid 
                  + '&authkey=' + authkey
                  + '&em=2&app=Excel')
    
     one_drive_df = pd.read_excel(url_excel)
    

Beware that this method works for Excel files in a personal OneDrive, not enterprise OneDrive

Importing Excel Files from a Personal OneDrive in Python
Older post

Promoting Data Marts in Power BI

And make them stand out from all other datasets in your account

Newer post

The Foundation Program

My experience following Eric Orton’s running plan, the Foundation Program

Importing Excel Files from a Personal OneDrive in Python