Question

How to conditional value in ExcelStyler


Badge +1

Hi, I have a row based information like

 

Price Sold2022 InStock

Row 1 252 Yes No

Row 2 59 No Yes

 

I saw example on how to color individual cell, but there cells where named A B C etc so I didnt really understand, my feature attributes are Sold2022 etc and will be written to an excel and I want for example the

 

Yes = Green cell

No = Red cell

Price over 100 = Red

 

I was thinking creating temporary attribute like p_price to mark the color, also I could conditional format in excel for Yes or No but if I want to color above or below price 100 then I would loose the value in the cell. Also saw example of cell.format() or similar to add to the writer.

 

Just need more guidance because I really don't understand how you set the cell you want colored in the ExcelStyler. should cell = attribute?


2 replies

Badge +10

Hi @clowncutie​ ,

You will need to select the name of the attribute you want to style in the ExcelStyler and then apply conditional formating. So in the examples, you saw using A B C, instead, you would use the name of your attributes.

You will need 3 ExcelStylers (one per attribute you need to style). This is how it would look:

ExcelStyler_Conditional 

I've also attached my sample workspace for you to review the ExcelStylers - please note that the Excel writer needs to have the additional format attributes added to ensure the formatting is written (if you don't see them, eg. "Sold2022.formatting", try changing the writer user attribute mode to "Automatic" and they should appear).

-Andrea

Badge +1

Hi @clowncutie​ ,

You will need to select the name of the attribute you want to style in the ExcelStyler and then apply conditional formating. So in the examples, you saw using A B C, instead, you would use the name of your attributes.

You will need 3 ExcelStylers (one per attribute you need to style). This is how it would look:

ExcelStyler_Conditional 

I've also attached my sample workspace for you to review the ExcelStylers - please note that the Excel writer needs to have the additional format attributes added to ensure the formatting is written (if you don't see them, eg. "Sold2022.formatting", try changing the writer user attribute mode to "Automatic" and they should appear).

-Andrea

Thank you so much!

Reply