Forum Discussion
Push data from excel to Power BI
Hi, below is my code for trying to push data from excel to Power BI by using the Import-Excel module with rest API. Can I use this way or not?
Connect-PowerBIServiceAccount
$body = '{
"name": "Employee",
"defaultMode": "Push",
"tables": [{ Import-Excel PathOfMyExcelFile | Out-String }]
}'
Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/groups/{datasetID}/datasets' -Method Post -Body $body
It has errors as below:
Invoke-PowerBIRestMethod : One or more errors occurred.
At line:9 char:1
+ Invoke-PowerBIRestMethod -Url 'https://api.powerbi.com/v1.0/myorg/gro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod
Thank you.
@v-shex-msft @Burningsuit @Tutu_in_YYC @GilbertQ @ibarrau @amitchandak @TomMartens edhans
2 Replies
- AnonymousNot applicable
Hi anonymous2 ,
You may refer this document.
https://docs.microsoft.com/en-us/rest/api/power-bi/push-datasets/datasets-post-dataset-in-group
Best Regards,
Jay
- anonymous2
Helper II
Hi Anonymous, thank you for your reply. From that documentation, it only supports push datasets whereas I want to import data from excel to Power BI using the rest API. I did try using that method from the documentation but it didn't work when I used it to import data from excel. Do you have another way to do that?
Thank you.