Search code examples
pythonpowerbipowerquerypowerbi-desktop

How to edit an already created Python Script in PowerBI?


In my Power BI dashboard, I created a Python Script that accesses an API and generates a Pandas data frame.

It works fine, but how can I edit the Python code?

I thought it would be something simple, but I can't really find how to find it in the interface. If I send the .pbix file to someone, they will receive an alert that a Python script is executing and display the code nicely formatted.

I can find the code if I go to "Model Exhibition -> Edit query -> Advanced Editor" (I'm translating the options from another language, they can be somewhat different). I is a M language code and the Python script is displayed as a long line as the image below:

How python code is displayed in power bi

I believe it is possible to open a text box to edit the Python script, but can't really find it.


Solution

  • In Power Query you should be able to click on the ribbon to insert Python code as below.

    enter image description here

    If the script is existing, then click the little cog icon to the right of the step in APPLIED STEPS as below:

    enter image description here