Home > other >  Conditionally format cells in a google sheet using pygsheets
Conditionally format cells in a google sheet using pygsheets

Time:12-29

I am trying to learn how to conditionally format cells in a worksheet using pygsheets. The reason for this is to only allow the end user interacting with a google sheet to only be able to input values that are in the correct format.

For example, how can we format the sheet so that:

  • cells A2 to A5 to be numbers between 0 and 50.
  • cells B2 to B5 to be an email address (a string say having @gmail.com or @yahoo.com).
  • cells C2 to C5 to be some string corresponding to a date.

If the cell does not meet the correct format the colour can change to a slight red to signify that it is not the correct format.

Using the two enter image description here

I suggest you first get acquainted with the pygsheets documentation to know the required parameters for each function. The Google docs can help to figure out what values these parameters can take.

References:

  • Related