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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
Community Champion
Community Champion

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.