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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.