I have a table in powerbi that I need to save once daily.
If I hover above the table, and click on the ...
menu, I can see it creates a button element in HTML that allows me to save data to CSV file with Selenium
However, in order to get this menu to appear in HTML, I need to call the javascript function that gets called to make the ...
appear, then to create the HTML menu with the save CSV function.
This gets a bit complicated, especially with thousands of lies of HTML and javascript code that creates the powerbi page.
Is there a way to automate the process just by using the powerbi table and recording the steps to capture which buttons/functions are called, either in Selenium, python, or some external application? (must run in edge or edgedriver). This needs to run on a windows PC with a locked screen
Thanks
CodePudding user response:
If you embed the report in a custom web page you can have a button that triggers the visual.ExportData Javascript API, EG https://playground.powerbi.com/en-us/dev-sandbox?showApi=reportExportVisualDataUnderlying
But that's an overly-complex and roundabout way to get data. Power BI has a direct API to get data from a Dataset. Datasets - ExecuteQueries, which you can call directly from python and you'll get the data in JSON. Then just convert it to CSV (eg via Pandas), and save it to a file.