Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change cell color when edited, but only for a limited time

I am very new to using Google App Script.

I am working on a Google Spreadsheet that will be edited by multiple users in our office. The spreadsheet is a schedule of order due dates. The information changes frequently (due dates are moved, new orders are added).

We would like to make it obvious when data has changed. I thought that changing the color of the cell would work as a good solution. However, I want the cell color to change back to white after some time as passed (a few hours, definitely no more than a day). I'm just looking for a temporary visual cue.

In a phrase: I want the background color of a cell to change each time the value of the cell is changed, but I want it to change back to white after a certain amount of time has passed.

Can this be done?

The closest solutions I found through searching is here:

How to change a google spreadsheet row color, when a cell in the row is edited?

That appears to change the entire row's color when a cell is edited, but it does not change the color back later.

That question also references another that tries to accomplish something similar: Google Spreadsheet: Script to Change Row Color when a cell changes text;

Thanks.

like image 596
user2952867 Avatar asked Nov 27 '25 16:11

user2952867


1 Answers

Yes its doable. Store your coloring actions somewhere like scriptDb. Install a hourly trigger that reverts the old actions by querying for timestamp less than your limit (say new Date().getTime-1000*60*60*8 for older than 8 hours)

like image 55
Zig Mandel Avatar answered Dec 01 '25 17:12

Zig Mandel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!