How to colorize cell via python?


How to color a cell via python?

For example, if the cells are empty, make those empty cells red.
I read this solution Colour Code Table Cells - #3 by Len_Kwok but I am asking how to change the color of a cell directly via Python or other Formula.

Grist doesn’t support conditional formatting yet. But it’s definitely looking like a common request, so might be something for us to add to the roadmap.

Meanwhile, besides this idea (Colour Code Table Cells - #5 by dmitry-grist), one other idea is to replace values with a colored emoji, which can be done using a trigger formula. Here is an example:

If you delete a value in a cell, it will get a red square in it instead of staying blank.


This did not work for me. The emoji is not appearing.

Hmm, maybe a browser difference? Try copy-pasting a unicode character from here: 🟥 Large Red Square Emoji – does that work?

The emoji is not showing - perhaps because of the browser.

  1. I do not understand why the 7th row is empty and did not show “red”. Shouldn’t be “red” as a default value by formula?

  2. The word “value” that is used in the formula is a default variable that can be used on every column, no matter the type of the column?

  1. The 7th row is not a real row, but a placeholder for a new row. Type into any field and hit enter to create the row.
  2. It is available for all columns, in trigger formulas only. What it contains may be surprising for some columns, eg references and attachments. It is mentioned in Intro to formulas - Grist Help Center

Relevant screenshot from that article:

1 Like

Thank you for the clear explanation!

Allowing color would allow error checking and validation without changing the text. I think python would be the best waynto do validation but maybe I missed something else.

By the way, conditional formatting is now here!