Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 49342

Can't refresh OLAP Cube generated by PowerBI through "Analyze in Excel"

$
0
0

I have a dashboard in PowerBI that gets refreshed every day through our Data Gateway. I also have an Excel pointing to that dashboard. I'd like this Excel to be already refreshed when I open the Excel. This is why I'm doing a little C# program that does that for me after the Data Gateway refreshes the dashboard. But I'm unable to do this... Here's my code:

Excel.Application excelApp = new Excel.Application();
excelApp.DisplayAlerts = false;
Excel.workbook workbook;

// ...

workbook.RefreshAll(); // this doesn't refresh the connection

// ...

foreach(Excel.WorkbookConnection wc in workbook.Connections){

    // I've also tried wc.OLEDBConnection.Reconnect()
    // Also I've tried to manually enable refresh file on open and then from here just switch that off
    // so when it opens it refreshes by default

    wc.OLEDBConnection.Refresh()

}

// ...

Through wc.OLEDBConnection I'm able to successfully access its properties (type, OLAP, RefreshDate,etc.) and add them to my logs, so I don't understand why it's not able to refresh it.

PD: this workbook.RefreshAll() code works for non-OLAP-connected spreadsheets.

 

 

Any help is appreciated! Smiley Happy


Viewing all articles
Browse latest Browse all 49342

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>