简体   繁体   中英

Programmatically change the data sources in a Power BI file

I need to use PowerShell to change the paths of the data sources of a local Power BI report file. For example, I want to change the data source path from C:\\.....\\sales.csv to D:\\.....\\sales_new.csv

I have found this four-year-old response to a quite similar question. I have followed the instructions and it is working quite fine. The only problem is that I need to refresh the Power BI report manually everytime after I changed the data source paths within the xml-file. With the term "manually refreshing" I mean that someone needs to open each Power BI file and confirm the refreshing of the data sources.

It is unsatisfying for my customer to manually refresh each Power BI report after altering the data source paths within the xml-file.

I have also read about the possibility, to change the ending a Power BI report file from *.pbix to *.zip, to extract it and open the "Connections" file to modify the path stored inside this file.

However, when I open the "Connections" file with Notepad, there is no data source path, like C:\\.....\\sales.csv , in this file.

Is there any way how I can programmatically change the data source paths in a local Power BI report file without the need to manually refresh the Power BI file after changing the data source path?

This answer helped me in solving my problem: https://community.powerbi.com/t5/Desktop/Power-BI-Desktop-does-not-resolve-parameters-for-connection/mp/2115774/highlight/true#M783462

It is not changing the data source path of a local report, as I asked, but on a Report which is stored in a Power BI Report Server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM