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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
risDS
Frequent Visitor

Unable to upload Excel data via API

Hello everybody,

I am trying to programatically upload an Excel file (could also be a JSON file) to a workspace using the API but I can't seem to make it quite work.

I am using the endpoint as specified at https://docs.microsoft.com/en-us/rest/api/power-bi/imports/post-import-in-group where the phrasing leads me to believe it should be possible to import Excel files this way.

 

Sample C# code used :

 

 

 

public bool ImportExcelFileToWorkspace(string filePath, string filename, string displayName)
        {
            var req = new HttpRequestMessage(HttpMethod.Post, $"https://api.powerbi.com/v1.0/myorg/groups/{Context.GroupId}/imports?datasetDisplayName={displayName}");
            var content = new MultipartFormDataContent();
            Stream fileStream = File.OpenRead(filePath);
            content.Add(new StreamContent(fileStream), displayName, filename);
            req.Content = content;
            Credentials.ProcessHttpRequestAsync(req, CancellationToken.None);
            var message = Client.HttpClient.Send(req);
            return message.IsSuccessStatusCode;
        }

 

 

 

I am using a class with a Credentials fields that uses the .NET API Connector and auth is fine.

Both the filename and displayname variables feature the file extension.

Using this method, I am being return an error 400 Bad Request with detail "ExcelWorkbookHasNoDataException" which is false.

 

Has anybody successfully used this endpoint like I am intending ? Any insight as to what I might be doing wrong ?

 

Thank you all in advance !

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @risDS  ,

 

Quick solution

  1. Edit your workbook in Excel.
  2. Select the range of cells that contain your data. The first row should contain your column headers (the column names).
  3. Press Ctrl + T to create a table.
  4. Save your workbook.
  5. Return to Power BI and import your workbook again

 

 

You need create a data model in your excel when you want to upload excel to power bi serive.

 

For more details, you can refer this link.

Error: We couldn't find any data in your Excel workbook - Power BI | Microsoft Docs

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-chenwuz-msft
Community Support
Community Support

Hi @risDS  ,

 

Quick solution

  1. Edit your workbook in Excel.
  2. Select the range of cells that contain your data. The first row should contain your column headers (the column names).
  3. Press Ctrl + T to create a table.
  4. Save your workbook.
  5. Return to Power BI and import your workbook again

 

 

You need create a data model in your excel when you want to upload excel to power bi serive.

 

For more details, you can refer this link.

Error: We couldn't find any data in your Excel workbook - Power BI | Microsoft Docs

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.