Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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 !
Solved! Go to Solution.
Hi @risDS ,
Quick solution
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.
Hi @risDS ,
Quick solution
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 8 | |
| 4 | |
| 4 | |
| 4 | |
| 3 |