Power Query can connect directly to a SharePoint folder to pull in multiple files—like Excel spreadsheets, CSVs, or text files—automatically, without manually opening each one. This is ideal for consolidating reports, logs, or datasets stored in a shared team library. Before you begin, ensure you have read access to the SharePoint site and folder, and that the files are in a supported format (e.g., .xlsx, .csv). You must be signed into Power BI or Excel with an account that has permission to the SharePoint location.

What You'll Need

  • A Microsoft account with read access to the target SharePoint folder
  • Power BI Desktop or Excel 2016 or later (with Power Query enabled)
  • The exact URL of the SharePoint site containing the folder (not the file path)
  • Internet connectivity to reach the SharePoint server

Step-by-Step

  1. Open Power BI Desktop or Excel. In Excel, go to the Data tab and select Get Data > From Other Sources > From SharePoint Folder. In Power BI, go to Home > Get Data > More > SharePoint Folder.
  2. In the dialog box, paste the full URL of the SharePoint folder. This is not the file path—it must start with https:// and include the site name, e.g., https://yourcompany.sharepoint.com/sites/TeamSite/Shared%20Documents/FolderName. Do not include subfolders or file names in this URL.
  3. Click OK. Power Query will attempt to connect and list all files in the folder. If prompted, sign in with your Microsoft account that has access to the SharePoint site. Use the same account you use to access SharePoint in your browser.
  4. Once the file list loads, review the preview. You’ll see columns like Name, Extension, Date Accessed, and Content. Do not click Transform Data yet—first, filter the list to include only the file types you need (e.g., .xlsx or .csv). Click the filter icon under Extension and uncheck all formats except the ones you want to process.
  5. Click the double-arrow icon in the Content column header to expand the file contents. A dialog will appear asking which file type to expand. Select the appropriate format (e.g., Excel for .xlsx files). If you're working with CSVs, choose CSV. Power Query will then attempt to load the first file’s structure.
  6. Power Query will auto-detect the schema of the first file. If the files have identical structure, click OK to apply this structure to all files. If they differ, you may see errors—proceed to Step 7.
  7. After expanding, you’ll see a table with one row per file and all its data. Use the Remove Columns option to delete unnecessary columns like Date Accessed or Folder Path if they’re not needed. Keep Name and the data columns.
  8. Use the Transform tab to clean data: remove headers if duplicated, change data types (e.g., Date to Date, Number to Whole Number), and apply filters to exclude empty or irrelevant rows.
  9. Click Close & Load to import the merged data into your workbook or report. You can now refresh this data anytime by right-clicking the query name and selecting Refresh.

Common Mistakes

  • Using the wrong URL: Many users paste the file path (like /Shared Documents/file.xlsx) instead of the full SharePoint site URL. Always use the site’s web address, not the file location.
  • Not filtering file types: Including unsupported files (like .docx or .pdf) causes errors during expansion. Always filter by .xlsx, .csv, or .txt before expanding Content.
  • Assuming all files have the same structure: If one file has an extra column or missing header, Power Query may fail. Check at least three files manually for consistency before connecting.
  • Forgetting to sign in: If you’re not signed into Power BI or Excel with the correct account, the connection will fail silently. Always test the URL in your browser first to confirm access.
  • Trying to connect to personal OneDrive folders: Power Query’s SharePoint Folder connector does not work with personal OneDrive. Use OneDrive > From OneDrive for Business instead.

Tips

  • Use a consistent naming convention for files (e.g., Report_202405.csv) to make filtering and sorting easier later.
  • Before connecting, create a test folder with 2-3 sample files to validate the setup. This prevents disruption to live data.
  • Enable Fast Combine in Power Query: Go to File > Options and Settings > Options > Current Workbook > Data Load > Enable Fast Combine. This speeds up merging large numbers of files.
  • Use the Query Settings pane to rename your query clearly (e.g., “Monthly Sales from SharePoint”) so it’s easy to find later.
  • For large datasets, consider loading data to a Data Model instead of a worksheet to reduce memory usage and improve performance.

Troubleshooting

  • If you see an error like “We couldn’t authenticate,” verify your login credentials. Sign out of Power BI/Excel, then sign back in using the same account that has SharePoint access. Restart the app if needed.
  • If the folder appears empty, check if you’re using the correct URL. Go to your browser, paste the URL, and confirm the folder exists and contains files. Also check that you’re not in a private browsing window when testing.
  • If files expand but data looks corrupted, it may be due to inconsistent headers or encoding. Open one file manually, note the structure, and adjust the Transform steps to match—especially for CSVs with non-standard delimiters.
  • If Power Query hangs or times out, reduce the number of files in the folder. Move older files to an archive folder. Large folders (>500 files) can cause performance issues.
  • For network errors, confirm your organization allows external connections to SharePoint. Some firewalls block Power Query’s access. Contact your IT department if you suspect this.

Frequently Asked Questions

Can I connect to a SharePoint folder from Excel Online?

No. Power Query’s SharePoint Folder connector is only available in the desktop versions of Excel and Power BI. Excel Online does not support this data source.

Do I need a Power BI license to use this?

No. If you’re using Excel 2016 or later with Power Query enabled, you can connect without a Power BI license. The connector is built into Excel’s Data tab.

What if files have different column structures?

Power Query will show errors when expanding. Use the Advanced Editor to manually merge files or add a step that standardizes columns before combining. Alternatively, filter out mismatched files before expanding.

Can I refresh this data automatically?

Yes. In Power BI, publish the report and set up automatic refresh in the dataset settings. In Excel, go to Data > Queries & Connections > Right-click query > Properties > Refresh every X minutes. Ensure the file is saved in OneDrive or SharePoint for cloud refresh.

Why do I see ‘Access Denied’ even though I can open the folder in my browser?

This usually means you’re signed into Power Query with a different account than the one used in your browser. Sign out of Power BI/Excel, then sign in again using the exact email address that has access.

Is there a limit to how many files I can pull?

There’s no hard limit, but performance degrades with over 500 files. For large collections, consider archiving old files or combining them into fewer files before uploading to SharePoint.