Get Data From OneDrive or SharePoint With Power Query
Get Data From OneDrive or SharePoint With Power Query
Get Data From OneDrive or SharePoint With Power Query
SALE 20% Off All Courses - Ends May 16th (8pm PDT) See
Courses (http://myonlinetraininghub.com/courses)
Note: The SharePoint Folder connector is only available in Excel 2019 (or
later) Professional Plus and with a Microsoft 365 Apps for Enterprise license.
See this comment (https://www.myonlinetraininghub.com/get-data-from-
onedrive-or-sharepoint-with-power-query#comment-105131) for a possible
workaround if you don't have a compatible license.
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 1/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Table of Contents
(https://www.youtube.com/c/MyOnlineTrainingHub?
YouTube
sub_confirmation=1) 999+
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 2/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Get Data from a Single File on OneDrive or SharePoint with Power Query
I’ll start with getting data from an individual file on OneDrive or SharePoint.
Either way the process is the same and it requires getting the file path, but not
the file path as you know it.
If you’re like me, you’ll have your OneDrive files synced to your hard drive.
You can see mine here in the file explorer:
If you try to copy a file’s path from here it will reference the copy of the file on
your hard drive, not the OneDrive/SharePoint file path.
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 3/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
The trick is to go to OneDrive or SharePoint online and open the file from
there in the Desktop App:
Then in Excel go to the File tab > Info and click the ‘Copy Path’ button:
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 4/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Now that you have the file path you can close the file and create a query in a
new Excel workbook using the From Web connector in Power BI or Excel
(shown below):
Paste the URL for the file into the dialog box, deleting the ?web=1 from the
end before pressing OK:
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 5/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
At the navigator dialog box, you can choose the sheet(s) or table(s) from the
list and then click Transform Data to load the data to the Query Editor where
you can perform further transformations before loading to Excel or the Data
Model:
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 6/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 7/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
I simply copy the portion of the URL up to _layouts/15…, which you can see
highlighted in pink.
Then in Power BI or Excel (shown below) you want the From SharePoint
Folder connector:
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 8/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Paste in the URL and at the authentication dialog box choose Microsoft
Account and sign in with your SharePoint logon credentials:
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 9/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Next, you’ll see a list of the files on your SharePoint site. Click Transform data
to filter the list to the folder you want:
Filter the Folder Path column to only show files that are contained in the folder
you want. You can use Filter > Text Contains > to enter part of your folder path
string. e.g. my files are in a folder with this path:
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 10/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
IMPORTANT: remember Power Query is case sensitive, so you must enter the
folder path exactly as it appears in SharePoint.
In the Power Query Editor, click the double down arrow on the Content column
to get the data from the files in the folder:
Choose the Table/Sheet that you want from each file, then click OK:
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 11/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
IMPORTANT: the sheet or table that you choose must have the same name in
each file you want to consolidate.
This will consolidate the data in each file into one table and from there you can
perform further transformations.
Lastly, if you work with Shared Libraries in SharePoint Online then the process
is a hybrid of the first and second examples. You can see in the screenshot
below that I’m in our My Online Training Hub Team Site and I want to get the
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 12/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
data from the Example Data folder. You can see it’s a Shared Library from the
list on the left.
There are two ways you can get the URL for the shared library, one is to copy
the domain from the URL, but you need to remove the -my from the URL
before pasting it into Power Query.
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 13/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Alternatively, if you open one of the files in the folder in the desktop app…
And copy the path from the File tab > Info
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 14/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
You’ll notice the URL you get through this path does not include ‘-my’ so it’s
ready to use by selecting the path up to and including .sharepoint.com/ e.g.:
https://your_tenant.sharepoint.com/
Then in Power BI or Excel (shown below) you want the From SharePoint
Folder connector:
And the process from here is the same as the previous example.
If you want to share files with other users you need to make sure they have
permission to access the file, folder or shared library.
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 15/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Then in Power Query they’ll also need to enter their credentials. Power Query
will prompt them to edit their credentials when they open the query editor. As
shown below where you can see a yellow warning bar below the ribbon.
Alternatively they can edit them via the Data Source Settings on the Home
tab.
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 16/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Edit Permissions
Edit to switch to a different account
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 17/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Thanks
Big thanks to fellow Microsoft MVP, Wyn Hopkins for demystifying connecting
to OneDrive or SharePoint in his video here (https://www.youtube.com/watch?
v=igcCbKqtwrk).
Power Query not only transforms data, it can transform your work load with
significant efficiency gains. Check out this introduction to Power Query video
(https://www.myonlinetraininghub.com/introduction-to-power-query). And if
you're ready for more, sign up for my Power Query course
(https://www.myonlinetraininghub.com/excel-power-query-course).
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 18/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
(https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-
with-power-query)
AUTHOR
Mynda Treacy
myonlinetraini
uthor/mynda)
nghub.com/a
(https://www. (https://www.myonlinetraininghub.com/a
uthor/mynda)
Co-Founder / Owner at My Online Training Hub
(https://www.myonlinetraininghub.com)
(https://mvp.micr
CIMA qualified Accountant with over 25 years experience in roles
osoft.com/en-
such as Global IT Financial Controller for investment banking firms
us/PublicProfile/5
Barclays Capital and NatWest Markets.
000748)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 19/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
(https://www.myonlinetraininghub.com/import-data-
from-web-to-excel)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 20/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
AI can now auto-detect tables and import them to your Excel workbook.
(https://www.myonlinetraininghub.com/get-started-
with-power-query)
(https://www.myonlinetraininghub.com/power-query-if-
statements)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 21/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
(https://www.myonlinetraininghub.com/power-query-
variables-3-ways)
(https://www.myonlinetraininghub.com/remove-blank-
rows-and-columns-from-tables-in-power-query)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 22/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
(https://www.myonlinetraininghub.com/extracting-
data-from-lists-and-records-in-power-query)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 23/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
(https://www.myonlinetraininghub.com/combine-
files-with-different-column-names-in-power-query)
(https://www.myonlinetraininghub.com/power-query-
keyboard-shortcuts-to-save-time)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 24/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
(https://www.myonlinetraininghub.com/remove-text-
between-delimiters-power-query)
(https://www.myonlinetraininghub.com/tips-for-using-
the-power-query-advanced-editor)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 25/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Converting Decimal
Change Type Using
Time to Days, Hours,
Locale with Power
Minutes, Seconds in
Query
Power BI
Comments
(https://www.myonlinetraininghub.com (https://www.myonlinetraininghub.com
/converting-decimal-time-to-days-
Carlos E Olvera /change-type-using-locale-with-
hours-minutes-in-power-bi) power-query)
October 26, 2023 at 5:15 am (https://www.myonlinetraininghub.com/get-data-from-
onedrive-or-sharepoint-with-power-query#comment-105132)
Hello Mynda,
I have an issue I can’t solve, and hopefully you can help me.
I can connect to a company’s SP site that has folders for every area and as a result I get a
table with ALL the files in that SP. The list is big, and it will only get bigger with time. I tried
making the path longer to include the folder, but any attempt results in an error.
I could filter the results in the path column depending on the area I need (ie sales) but see
two potential problems:
1. As the size increases, will it make it slower?
2. Regarding security, will this show files to those that don’t have access, or will they only
see the files they have permission?
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 26/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Reply
Mynda Treacy
I haven’t tested if the query gets slower as the SP list increases. PQ only brings in a
sample of the data/list, so in theory, it shouldn’t make a big difference assuming you filter
out what you don’t need before Close & Load.
Regarding security, I’m not sure but even if it shows the file names, it won’t load the data
because you don’t have permission.
Mynda
Reply
Brandon Harrison
Thanks
Reply
Mynda Treacy
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 27/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Reply
Brandon Harrison
I’m logged in with the correct credentials. If I put the SharePoint root URL for the company
SharePoint site, then the “Folder Path” shows all null values.
Interestingly, if I use the “From Web” process to connect to a single file in the folder that I
want access to for all the files, then it works fine. Its just not allowing me to connect using
the SharePoint Folder Connector.
Reply
Mynda Treacy
Reply
Brandon Harrison
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 28/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Hi Mynda,
I see all files in the folder.
Mynda Treacy
pgSystemTester
Reply
Mynda Treacy
Reply
Leslie
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 29/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Reply
Mynda Treacy
Reply
Tamer
How can we save a file in the link below to the local computer?
Link: https://onedrive.live.com/view.aspx (https://onedrive.live.com/view.aspx)?
resid=1376F399A4120875!1937&ithint=file%2cxlsx&authkey=!Ag3bU1cS7sd7Xko
thanks in advance
Best
Reply
Mynda Treacy
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 30/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Reply
lookrider
“Note: The SharePoint Folder connector is only available in Excel 2019 Professional Plus
and with a Microsoft 365 Apps for Enterprise license.”
I guess this means that if I have a normal Microsoft 365 licence, I can’t use this function?
I have also seen that when I copy the OneDrive link, it points to a “https://d.docs.live.net
…” address
Reply
Mynda Treacy
Reply
Carlos E Olvera
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 31/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Reply
Mynda Treacy
Reply
Brian
Reply
Mynda Treacy
Reply
H S Kalsi
Reply
Lukasz
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 32/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
I noticed quite strange behaviour loading data from SharePoint. I’ve recreated my local
folders the same way I have them on my local drive. However, when I use connection to
Sharepoint Excel doesn’t pull all of the data. I’ve noticed it on 20k lines Excel files. So, I
have 3 very similar files. On my local version when I combine and remove duplicates I get
25,021 lines. However, using the same technique with Sharepoint folder 3,715 lines.
I guess that loading the connect from Share point it limits it to 2,000 lines. So, what I get is
only a part of new data. Do you know how to get all of the data when loading from
Sharepoint? The alternative option would be to split the files under the limit and then
upload them to Sharepoint.
Kind regards,
Lukasz
Reply
Mynda Treacy
Reply
Roshan Matooreah
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 33/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Reply
Mynda Treacy
Power Query doesn’t return reports as such. Power Query returns a dataset from which
you can create a report. For more on automatic refresh, see this tutorial: https://www.myon
linetraininghub.com/auto-refresh-pivottables (https://www.myonlinetraininghub.com/auto-re
fresh-pivottables)
Mynda
Reply
Beth
So I removed that Word doc. The rest of the files are mostly PDF. Again I click Content
double-down arrows. Power Query evaluates for awhile. Then I received a message:
Connecting. Please wait while we establish a connection to PDF. After that’s complete, the
Combine Files screen shows Display Options > Parameter1 [4] Page (001-004). There is
no data in them when I select the pages. Table and sheet are not even listed under this.
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 34/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
I’m not sure if I’m doing something wrong or if what I’ve trying to achieve is possible.
Please adivse. Thank you.
Reply
Mynda Treacy
Try saving the PDF file to your desktop and use the Get Data > From File > PDF connector
to rule out that it’s not the file that’s the problem.
Mynda
Reply
Samuel
Reply
Mynda Treacy
Reply
Chris
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 35/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Reply
Mynda Treacy
Yes, unfortunately this is a licensing limitation 🙁 The SharePoint connectors are available
in 365 Apps for Enterprise or the Office 2019 standalone licenses.
Mynda
Reply
Blog Categories
AI in Excel (https://www.myonlinetraininghub.com/category/ai-in-excel)
Excel (https://www.myonlinetraininghub.com/category/excel)
Excel Charts (https://www.myonlinetraininghub.com/category/excel-charts)
Excel Dashboard (https://www.myonlinetraininghub.com/category/excel-
dashboard)
Excel Formulas (https://www.myonlinetraininghub.com/category/excel-formulas-
and-functions)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 36/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
(https://mvp.microsoft.com/en-
us/PublicProfile/5000748)
(https://www.trustpilot.com/review/www.myonlinetraininghub.com)
(https://monitor20.sucuri.net/verify.php?
r=238d919b8ae7a94986fd22b61703437c3be0984f60)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 37/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
(https://www.youtube.com/@MyOnlineTrainingHub)
(https://www.linkedin.com/in/myndatreacy/)
(https://www.instagram.com/mynda.treacy/)
(https://twitter.com/OnlineTrainingH)
(https://www.pinterest.com.au/myndatreacy/)
(https://www.facebook.com/MyOnlineTrainingHub)
Company
Support
Contact (https://www.myonlinetraininghub.com/contact-us)
Forum (https://www.myonlinetraininghub.com/excel-forum)
Helpdesk – For Technical Issues (https://www.myonlinetraininghub.com/help-
desk)
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 38/39
09/05/24, 17:25 Get Data from OneDrive or SharePoint with Power Query • My Online Training Hub
Copyright © 2024 · My Online Training Hub (https://www.myonlinetraininghub.com) · All Rights Reserved. Microsoft and the Microsoft Office
logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos,
brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.
https://www.myonlinetraininghub.com/get-data-from-onedrive-or-sharepoint-with-power-query 39/39