Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
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.
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.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.