In this blog post, I will be sharing a PowerShell script that allows multiple Power BI reports to be uploaded at once. In a previous blogpost, I shared a PowerShell script that allowed users to downloaded multiple Power BI reports. Combined you could move several reports from one workspace to another in a few seconds.
The script is downloadable at the bottom of the page as a txt file. To use the script there are three steps to take.
The first step is to install and import the MicrosoftPowerBIMgmt PowerShell module. The following code should do the trick.
The second step is to fill in the variables at the top of the script:
- Workspace Name
- Report Name
- Upload Path
Workspace Name – The name of the workspace in which the report or reports are to be uploaded to.
Report Name – This can be configured to upload one, multiple or all reports in the folder.
One report = @(‘Report 1’)
Multiple reports = @(‘Report 1’, ‘Report 2’, ‘Report 3’)
All reports = @()
Upload Path – The folder where the report or reports are saved.
Conflict – This parameter decides what happens when we upload a report to a workspace, where a report with the same name already exists.
Ignore. Ignores the report already uploaded, this means the workspace ends up with two reports with the same name.
Abort. This errors the code and leaves the uploaded report as it is.
Overwrite. This overwrites the report already uploaded, if the report doesn’t already exists the upload will fail.
CreateOrOverwrite. This should be your default selection. If the report already exists, it will overwrite it. If the report doesn’t exist, it will upload it as a new report.
Once these variables are assigned the script is ready to be executed.
The third and final step is to sign into Power BI, a prompt asking you to sign into Microsoft Azure will pop up. Use the credentials you would use to sign into PowerBI.com.
The script should now run in full and bring the PBIX files into the workspace.
The script is attached as a txt file.