Forum Discussion

anonymous2's avatar
anonymous2
Icon for Helper II rankHelper II
4 years ago

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