Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MP_T
New Member

Edit Python Get Data script without losing formatting

I have a Power BI report that gets data via a python script. The import script retrieves around 25 tables and supports a report of multiple pages. However, if I want to make small edit to the get data script, I can either delete the original data tables in Power BI or just import again. If I import again I get duplicate tables. Deleting and reimporting means I lose most or all of the column formatting and lose formatting in the visuals on settings like currency and how many decimal places to show. Is there a way that I can edit the python get data script without losing the table formatting and settings in the visuals? For example say the script is pulling in 25 tables and I want to amend it so it will pull in a 26th but the other 25 are unchanged, I don't want to have to manually change the formatting on the other 25 tables & all the visuals every time I modify the python script.

 

One solution could be to put a database (or flat files) in the middle so the python script populates the database (or flat files) and Power BI queries the database (or flat files) but I am looking for a direct solution. If it isn't possible any other workaround suggestions might also be useful.

 

I am new to Power BI but have quite a lot of python experience.

1 ACCEPTED SOLUTION
MP_T
New Member

Hi Daryl

 

Thanks for this link, it does look like it would help. In the end I went for the flat file approach. That means that I don't have to get all the python into a single script inside Power BI and I can keep all the coding on the python side. I'm sure there are other ways to do this and potentially better ways but at least the original issue was resolved.

View solution in original post

2 REPLIES 2
MP_T
New Member

Hi Daryl

 

Thanks for this link, it does look like it would help. In the end I went for the flat file approach. That means that I don't have to get all the python into a single script inside Power BI and I can keep all the coding on the python side. I'm sure there are other ways to do this and potentially better ways but at least the original issue was resolved.

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @MP_T , I was wondering if the following blog post helps you understand how Power BI approaches data types when expanding tables:

Chris Webb's BI Blog: Setting Data Types On Columns Containing Table Values In M Chris Webb's BI Blo...

 

There are some additional changes that you can do make this more dynamic if the columns in the Python results are changing.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors