1

So I have this script on Powershell which generates a csv that is used on a Power BI template. When it is done with the csv it is supposed to open the template and show a report with the data updated but I still need to refresh it by hand.

Edit: Forget it. The template opens updated but I still don't know if I can generate the report with commands

I have thought about using a "refresh update" and upload the report to the Power BI server but I don't want it to be only avaliable online.

This is my script (very basic version since its long):

#lots of commands to make the csv Invoke-Expression "file" 

The commands generate a clean csv which can be used with a common import but in R they appear as empty fields - probably because idk how to use R properly.

Is there any way I can do what I want using this script without having to upload the report first?

Thanks for your answers!

1 Answer 1

1

Since nobody is going to answer me, I'll give my final solution which is pretty bad but I want to close this asap so if anyone's having the same problem they can find a fast temporal solution.

My script to make tests:

##This creates a table which is used on a Power BI template $num=0 $numpro=Read-Host -Prompt "Enter number of products" echo("Name,Amount,Price") > products.txt DO { $num=$num + 1 $product=Read-Host -Prompt "Name of the product: " $amount=Read-Host -Prompt "Amount we have of the product: " $price=Read-Host -Prompt "Price for each product unit: " echo("$product,$amount,$price") >> products.txt }while($numpro -gt $num) import-csv products.txt -delimiter "," | Export-csv products.csv ##clean lines cat products.csv | where { $_ -match "#"} > delete.txt $erase=Get-Content delete.txt cat products.csv | %{$_ -replace "$erase",""} > def.txt GC def.txt | where{$_ -ne ""} > products.csv rm products.txt rm delete.txt rm def.txt Invoke-Expression "full path to our .pbit" 

Just use the script a first time without using "Invoke-Expression" to create a first table that you will use to create the template. After creating the template, just use it full.

Btw: You have to use absolute paths on Power BI so don't change the file that contains the table and, if you do that, be sure to change the source and save the template again.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.