Export datasets from Power BI Service to CSV using VBA
Downloading a Power BI Dataset with VBA wasn’t really a thing I planned to do until Microsoft released the new PBI Usage datasets. In this article, I’ll describe the steps to export datasets from Power BI Service to CSV using VBA.
Classic download options
If you want to download a dataset from Power BI Service (PBIS), you have several options at your hands:
But you can’t enrich the data in none of these options. This isn’t really an issue as long the data source is in your control.
With the introduction of the usage datasets, this particular dataset is out of your control. You can measure the usage of just one workspace but you can’t build a report of the usage across all workspaces.
I searched for a possibility to build one single usage report across all workspaces and came up with this VBA solution. Yes, the good old VBA, the most hated programming language in the world. I’m pretty sure that one can achieve the same goal with C# or VB, but most Excel Cracks out there know VBA.
Did as you described but found an error on GetString method. It says that adClipString is an undefined variable. When i replaced "adClipString" for "2", the value of the adClipString StringFormatEnum , it worked for a while. But recently it pops a "Method 'Open' of object '_Recordset' failed" error when i run the macro. Thx @Anonymous for the amazing solution btw!