sheetfu
sheetfu copied to clipboard
Feature suggestion: truncate floats to specific number of decimal when setting colors
I noticed that setting a cell value (or background colour, or note, etc.) always results in an entry in table.batches
, even if you are setting the value to the initial value. This then results in the sheet changing
I can check it manually of course
if item.get_field_value(score_name) != score_entry['value']:
item.set_field_value(score_name, score_entry['value'])
table.commit()
but it could be built into the library by caching the initial value, and checking it. You might want this as opt-in option on Table though.
Also it might not be easy to do for background colour. Setting a color like #80FF80
in sheetfu gets stored by sheets as backgroundColor": {"red": 0.5019607843137255, "green": 1.0, "blue": 0.5019607843137255}
, so the setting #80FF80
will always look like a change.
Regarding your first point, I think we should keep it as it is, and prevent doing too much comparison on data. If the set method is called, I would insist that an action should be made even if existing value and value being sent are the same. In addition, because we are batching those requests, we're essentially making just one request to Google API at the end and the gain in peprformance is debatable.
On the color settings however, you're making a very good point. I suppose we could truncate at a certain number of decimals (4 or 5 maybe?).
I'm currently working on a few features that have been asked, I could easily add the float thingy in here without issue.