Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
anonymous2
Helper II
Helper II

How to load an excel file to Power BI using Powershell?

Hi, I need to load an excel file to Power BI using Powershell and then get data also using Powershell. Then use them to create a relationship. Does anyone know how to do it?

Thank you in advanced.

2 REPLIES 2
Anonymous
Not applicable

HI @anonymous2,

AFAIK, the current power bi desktop does not support directly invoking PowerShell to get data.

In my opinion, I'd like to suggest you directly use the power bi desktop client 'get data' functions to get data from an excel sheet or try to use power query with integrated R/Python scripts and packages to interact with PowerShell.

Use R in Power Query Editor - Power BI | Microsoft Docs

Using Python in Power BI Power Query Editor - Power BI | Microsoft Docs

Perhaps you can take a look at the following link with similar requirements if help:

Solved: Power BI Get Data using Powershell - Microsoft Power BI Community

BTW, if you mean to use Powershell with rest API to push dataset to power bi service, that is possible. (power bi service has disabled these types of edit features so you can change relationships)

Regards,

Xiaoxin Sheng

Hi @Anonymous, thank you for your suggestions. I already imported an excel file in Power BI service then I want to create a relationship using rest API post method in Powershell using the data in the excel. But it didn't work. May I know is there a way of doing it? Are relationships can only be seen on Power Bi Desktop?

'BTW, if you mean to use Powershell with rest API to push dataset to power bi service, that is possible. (power bi service has disabled these types of edit features so you can change relationships)'

Yes, I managed to push dataset to power bi service and create relationship using PowerShell. My current problem is, using imported file(excel) to create relationship in powershell. Do you know how to do it?

Thank you.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.