Streamlit AgGrid table formatting


i want to format the table, for example header columns with some color and values with another color.

import pandas as pd
from st_aggrid import AgGrid
from st_aggrid.grid_options_builder import GridOptionsBuilder
import streamlit as st
import datetime

# Sample event data
events_data = [
    {"EventID": 1, "EventName": "Conference A", "StartDate": "2024-01-17", "EndDate": "2024-01-19", "Location": "City X"},
    {"EventID": 2, "EventName": "Workshop B", "StartDate": "2024-02-05", "EndDate": "2024-02-07", "Location": "City Y"},
    {"EventID": 3, "EventName": "Seminar C", "StartDate": "2024-03-15", "EndDate": "2024-03-17", "Location": "City Z"},
    # Add more sample events as needed

df = pd.DataFrame(events_data)

options_builder = GridOptionsBuilder.from_dataframe(df)

grid_options =

grid = AgGrid(df, gridOptions=grid_options, height=350, width=250, theme='streamlit', allow_unsafe_jscode=True)
1 Like