Dash datatable Conditional Formatting

Is is possible to style a cell based on the info that is in the cell next to it?

I would like to get the same color to match the cell to the right

Sure - the easiest way is to apply the same formatting to the column and the one to it’s left, for example:

import dash
import dash_table
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randn(6,4), columns=list('ABCD'))

app = dash.Dash(__name__)

app.layout = dash_table.DataTable(
    id='table',
    columns=[{"name": i, "id": i} for i in df.columns],
    data=df.to_dict('records'),
    style_data_conditional=[
        {    

            'if': {
                'filter_query': '{C} >  0',
                'column_id': ['B', 'C']
               
            },
            'backgroundColor': 'dodgerblue',
            'color': 'white'
        },
    ]
)

if __name__ == '__main__':
    app.run_server(debug=True)

And note - ability to use a list for column_id , row_index , and header_index was added in Dash 1.12.0

Thank you so much!!! This worked great and gave me lots of good ideas on how to use formatting. Great help!!

Super - glad it helped! :grinning:

A lot of great examples were added to the tutorial recently. The latest release had many cool new features for data tables.

https://dash.plotly.com/datatable/conditional-formatting.