Using this documentation to make my table rows different colors based on the value of one of the columns.
# This list will be used to create a JSON like structure that will insert rows for our styles
output_json=[]
# Here we can define what styling on our rows will be.
style_orange={"backgroundColor":"#F7901D"}
style_green={"backgroundColor":"#00AA00"}
# You could change more than just the background color, for example:
# style_another_example {"backgroundColor": "#00AA00", "font-weight": "bold"}
forrowinrange(value.getRowCount()):
row_object={}
row_value={}
row_style={}
forcolinrange(value.getColumnCount()):
row_value[value.getColumnName(col)]=value.getValueAt(row, col)
row_object['value']=row_value
# Here we're checking the name of the column that we want to base our styling on.
ifvalue.getColumnName(col)=='B':
# Here we're checking for individual values within the column, and applying styling
ifvalue.getValueAt(row, col)=='One':
row_style=style_orange
elifvalue.getValueAt(row, col)=='Two':
row_style=style_green
row_object['style']=row_style
output_json.append(row_object)
returnoutput_json
Is there a way to export the data to excel and maintain the color formatting?