gspread icon indicating copy to clipboard operation
gspread copied to clipboard

Added Conditional Formatting Rules logic

Open mcorrigan opened this issue 1 year ago • 5 comments

Added some logic for handling the retrieval and removal of conditional formatting rules.

I can't run the tests on my work account, but I believe they are correct. Feel free to do what you will with it.

mcorrigan avatar Sep 03 '24 15:09 mcorrigan

Hi

I ran your tests locally with (I use PowerShell on Windows), and fixed a couple of errors.

> $env:GS_RECORD_MODE="all"
> $env:GS_CREDS_FILENAME="tests/creds.json"   
> pytest -k "conditional_format" -v -s

Please see the contributing guide for more help on how to run tests

However, the tests still fail.

Please could you explain the motivation for your change? :)

alifeee avatar Sep 09 '24 16:09 alifeee

Hi

I ran your tests locally with (I use PowerShell on Windows), and fixed a couple of errors.

> $env:GS_RECORD_MODE="all"
> $env:GS_CREDS_FILENAME="tests/creds.json"   
> pytest -k "conditional_format" -v -s

Please see the contributing guide for more help on how to run tests

However, the tests still fail.

Please could you explain the motivation for your change? :)

Thanks for catching those, it would definitely be easier if I could run the tests myself but I'm not set up to do that at the moment.

The reason for the changes was just to get and set conditional formats in the Google Sheet via your API instead of directly through the client.

https://developers.google.com/sheets/api/guides/conditional-format

mcorrigan avatar Sep 11 '24 23:09 mcorrigan

before I continue, have you looked at gspread formatting?

find https://gspread-formatting.readthedocs.io/en/latest/index.html on https://docs.gspread.org/en/latest/community.html

alifeee avatar Sep 19 '24 17:09 alifeee

I had no idea that existed, it looks awesome! Probably would work for what I'm trying to do here. I'll look at trying it out with my code. Thanks!

mcorrigan avatar Sep 20 '24 13:09 mcorrigan

Maybe you already can do this, but one thing that would be nice is if there was a simple interface to performing batch operations in gspread like exists in gspread-formatting but with simple function calls like hide_columns() and hide_rows() instead of aggregating request objects.

mcorrigan avatar Sep 20 '24 15:09 mcorrigan