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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.