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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
lazarc
Regular Visitor

Upload XL file to Power BI Report Server

PBI issue.jpg

When uploading XL file to Power BI report Server getting the XL error as shown in the image.

When manually uploading the XL, it works without any issue, but when uploding using the code as shown in the image, getting the error as shown in the image. Please hime.

4 REPLIES 4
Jon-Heide
Microsoft Employee
Microsoft Employee

Are you using the server REST API's?

 

https://app.swaggerhub.com/apis/microsoft-rs/PBIRS/2.0

 

You'll need to PUT as an Excel item rather than a resource.

 

Thanks Jon, Let me look into it, Thanks for your time helping. Very much appreciated,

Hello Jon,

Could you provide REST API  implementation sample code to upload XL to power BI Report Server, Very new to REST API and need some assistance. Thanks for your help. Thanks for your time, Very very much appreciated.

The issue is that when opening the file a NULL value was being added to the end of the file and corrupting it.

The problem resolved this by adding a [-1] to the length of the file.

 

Public Sub Main()

  Try

               DIM stream As FileStream = File.OpenRead(FILEPATH  )

                definition = New [Byte](stream.Length -1) {}

                stream.Read(definition, 0, CInt(stream.Length))

                stream.Close()

  Catch e As IOException

                Console.WriteLine(e.Message)

  End Try

  Try

                rs.CreateResource(REPORTNAME, REPORTSERVER_FOLDER, False, definition , "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",Nothing)

 

  Catch e As Exception

                Console.WriteLine(e.Message)

  End Try

End Sub

 

-----------------------------------------------------

Please find the below link for more info.

 

https://stackoverflow.com/questions/2770210/programatically-upload-xml-file-to-ssrs-server

 

 

Thanks for your time looking into it, Very much appreciated.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.