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
Edusegoviano
New Member

Preserve cell fill color when importing from web

I am importing data to Excel from a website using power query and I have a big problem, the data is imported great but there is a very important fact that I lose, the fill color of the original page. Although in the preview of the web to load it comes out, I lose it.

Any ideas please? I've looked up on chatgpt and nothing...

5 REPLIES 5
BA_Pete
Super User
Super User

Hi @Edusegoviano ,

 

Power Query only deals in data, not colours/formatting etc.

You would need to understand the logic that determines the colour on the website, then apply that logic to your values using conditional formatting in Excel.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Thank you @BA_Pete , but in that case background color of each cell is an important data. Each color means different things, and I need that data

 

In that case, you may be able to scrape the colour value fom the website HTML.

In Power Query you can use the Web connector dialog to pick out HTML segments from websites so you could, in theory, identify the colour along with the value, but I've never done it that in-depth before myself and sounds like it could get quite fiddly.

 

Have a go at connecting to the site using the web connector then see if you can identify the correct part of the HTML using the 'Table From Examples' button.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




I have tried to do it, but it seems that from power query for excel the HTML cannot be accessed, only from the desktop. Also, the "Add using examples" button does not appear. Any other ideas? Thank you so much

 

I've just tested on M365 v2301 and you're right, Excel seems to be using a slightly de-functioned version of Power Query.

I don't know what to suggest in that case I'm afraid. Maybe install Power BI Desktop and see if you can do what you need from there?

Beyond that, you may need to use a more advanced scraping method, perhaps a third-party app or Pthon script?

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.