Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I want to upload an Excel/CSV file on an on-premise PBI portal using the API REST.
I'm able to upload a new file, but cannot succeed in overwriting it.
I use On-Premise Power BI Report Server Version 1.8.7485.35104 (May 2020).
Is there any limitation on API REST with the On-Premise version?
I did some tests using the PowerShell exemple, and the documentation on the SwaggerHub.
This PS code works well for a new file:
$ReportPortalUri = 'myreportportal'
$catalogItemsUri = $ReportPortalUri + "/api/v2.0/ExcelWorkbooks"
$uploadItemPath = 'myfile'
$bytes = [System.IO.File]::ReadAllBytes($uploadItemPath)
$payload = @{
"@odata.type" = "#Model.ExcelWorkbook";
"Content" = [System.Convert]::ToBase64String($bytes);
"ContentType"="";
"Name" = 'myfilename';
"Path" = 'myfilepath';
} | ConvertTo-Json
Invoke-WebRequest -Uri $catalogItemsUri -Method Post -Body $payload -ContentType "application/json" -UseDefaultCredentials
Then, I did some tests using the PATCH method and the GUID of the file.
...
$catalogItemsUri = $ReportPortalUri + "/api/v2.0/ExcelWorkbooks" + "(myguid)"
...
Invoke-RestMethod -Uri $catalogItemsUri -Method Patch -Body $payload -ContentType 'application/json' -UseDefaultCredentials -UseBasicParsing -Verbose
This works when I use simple attributes, such as "Description" in the $payload
But this does not work when I use the "Content" attribute, the same way as for a new file : I got error "System.InvalidOperationException: Nullable object must have a value". What am I missing here?
I also did some tests using the POST method on Model.Upload function with multipart/form-data content type.
But I got error "Unsupported Media Type". What am I missing here?
Any exemple on how to use the Model.Upload function?
Any feedback on using the API REST with a On-Premise version?
Hi @jerome_dal ,
According to the offical blog, I think Power BI only support us to import .xlsx file from OneDrive for Business.
Supported content:
filePath
set to the .xlsx file path in the request body.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello,
It's possible to import Excel/CSV files with the On Premise version. There was a bug with the "May 2020" version preventing the upload with overwrite.
I tested with "January 2022" version and it is ok now for the PATCH method on ExcelWorkbooks(guid).
But I still have problem using the POST method on ExcelWorkbooks(guid)/Model.Upload to handle with files larger than 25Mb. I get a "(415) Unsupported Media Type" from the report server.
Any idea?
Does anyone have an exemple of code using method ExcelWorkbooks(guid)/Model.Upload?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
8 | |
7 | |
2 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |