Forum Discussion
Refresh not running R script
v-lid-msft , I tested your code and it works. It also works when I modify from write.csv to write.table and add append=TRUE, which is what I have used on my data. It seems to be refreshing and updating the csv both in query editor, desktop view and via scheduled refresh, although creating some duplicates.
For my dataset (which is only 130kb) I experience the following:
1. The csv file is updated when I refresh from the query editor
2. The csv file is updated every time I open the .pbix file (which is surprising and does not happen with your example)
3. The csv file is not updated when I refresh from desktop
4. The csv file is not updated when I run scheduled refresh in the online version.
Any ideas? It seems that the refreshes are stored as backlogs until I close and open the pbix file.
For reference I am running this:
# 'dataset' holds the input data for this script
df <- data.frame(dataset)
write.table(df,"H:/Power BI/ProdData.csv",sep = ",", col.names = !file.exists("H:/Power BI/ProdData.csv"), append = TRUE)
where the data source is a 130kb table from SAP Business Warehouse.
I am also having this exact same issue.