Skip to content

Loading Data from One-Drive Personal

Several companies offer free online file storage, among them Dropbox, Google Drive and Microsoft’s OneDrive Personal. This page shows how to load an Excel file stored on OneDrive Personal straight into Power BI or Excel. Because the file is read from the cloud, a report published to the Power BI service can refresh it without a gateway.

OneDrive for Business works differently, because Power Query can sign in to it with an organisational account. OneDrive Personal needs the workaround described here.

The process has four steps:

  • Save the file, usually an Excel workbook, to OneDrive Personal, and let it sync to the cloud, or upload it by hand.
  • Open the folder that holds the file in a web browser.
  • Build a download address for the file that Power Query can read.
  • Load the data with Power Query’s web connector.

The example uses a small workbook of sales data, saved as ETL - One Drive Sales Data.xlsx in a OneDrive Personal folder that syncs automatically.

The quickest way to find the file online is to right-click the folder that contains it in File Explorer and choose View online. Right-clicking the folder, rather than the file, opens the folder’s listing in the browser, as below, where the file can be selected.

A OneDrive folder listing in the browser, showing two Excel files with their modified dates, sharing status and sizes, including ETL - One Drive Sales Data.xlsx

OneDrive does not show a direct download address, so it has to be built from the file’s embed code.

Click the three dots next to the file (1 in the picture), and then click Embed (2).

The menu for ETL - One Drive Sales Data.xlsx, with the three-dot button marked 1 and the Embed command marked 2

A panel opens on the right with a preview of the workbook and, beneath it, the embed code, which is an HTML iframe tag.

The embed panel, showing a preview of the sales table and an iframe tag whose src address contains cid, resid and authkey values, partly blanked out

Copy all of the embed code into a text editor such as Notepad, and edit it as follows:

  • Delete everything before the address, which is the start of the iframe tag up to and including the opening quote.
  • Change embed? to download?, keeping the question mark.
  • Keep the resid and authkey parameters, which identify the file and grant access to it. The cid parameter can be removed, although the screenshots below still show it, and the address loaded with it in place.
  • Delete everything after em=2.

The edited text should look like this:

Notepad showing an address that starts https://onedrive.live.com/download? followed by cid, resid and authkey values and ending em=2, with the identifiers blanked out

Finally, add &app=Excel to the end of the address.

The same address in Notepad, now ending em=2&app=Excel

This is the address that Power BI Desktop, or Excel, uses to load the file.

  • Open a new Power BI Desktop file, click Get data, and choose Web.

The Get data menu in Power BI Desktop, with Web highlighted under Common data sources

  • Paste the address into the From Web dialog, and click OK.

The From Web dialog with the Basic option selected and the OneDrive download address, ending app=Excel, in the URL box

If Power Query asks how to connect, choose Anonymous. Power Query cannot sign in to OneDrive Personal with a Microsoft account, so access comes from the authkey in the address instead. This means that anyone who has the address can open the file, so treat it like a password.

The Navigator then lists the tables and sheets in the workbook. Select the data you need.

The Navigator listing Sales_Table and Sheet1 from the OneDrive address, with a preview of Sales_Table showing order date, product key, sales quantity, unit price and sales

Click Load to load the table into Power BI Desktop. A quick visual confirms that the data has arrived.

A Power BI matrix of sales by year and quarter for 2020, built from Sales_Table, with the Visualizations and Fields panes alongside

When the browser cannot preview the workbook

Section titled “When the browser cannot preview the workbook”

OneDrive limits the size of workbook it will display in the browser. If the file is larger than 5 MB, trying to preview it, including in the embed panel, shows an error.

The limit applies only to showing the workbook in the browser as if it were Excel. Power Query reads the file without trouble, so ignore the error if it appears while you copy the embed code. When you connect with Power Query, do not choose the web preview, and the file will load as normal.

OneDrive Personal files can also be reached in other ways, such as with Power Automate, but the method on this page is simple and reliable.

The method on this page follows Matt Allington’s post Loading a File from OneDrive Personal into Power BI Desktop on Excelerator BI.