Changing the background colour of cells edited in the last 10 minutes

Hi,


I need to easily see the cells in a Numbers spreadsheet that I have updated in the last 10 minutes. I have put this applescript together with Chat GPT and some basic knowledge. I have triggered it in Automator and it runs and brings the correct spreadsheet to the front but the cells don't change colour. I am wondering if anyone is able to see what I am doing wrong?


After 10 minutes I need the cells to turn back to not having any background fill.


My Applescript skills are very basic and so I would appreciate any help?



on run {input, parameters}


tell application "Numbers"


activate


try


set theDocument to document "Placemats.numbers"


tell theDocument


set editedCells to {}


repeat with t in every table of every sheet


repeat with r in every row of t


repeat with c in every cell of r


if modification date of c is greater than ((current date) - (10 * minutes)) then


set end of editedCells to c


end if


end repeat


end repeat


end repeat


repeat with editedCell in editedCells


set background color of editedCell to {65535, 0, 0} -- Red color


end repeat


end tell


end try


end tell


return input


end run

Posted on Mar 13, 2024 5:33 AM

Reply
2 replies

Mar 13, 2024 5:42 PM in response to skinnymulddon

I do not think this is possible. To the best of my knowledge Numbers does not keep track of when a cell was edited and "modification date" is not part of the Numbers suite. it is not a cell property, it is a file property. The script should have failed on that line.


The best I can think of would be a janky AppleScript that polls specific cells or a range of cells (or all cells) to see if the value is different from the last time it looked. This isn't quite the same as "last edited" because "edited" includes retyping the same value. Without getting into detail on tracking the time and setting background colors, whenever it sets the background color of a cell it will steal focus from what you were doing and will select the cell that needs a new color. You will not be able to use the spreadsheet while the script is running if there are any cells that might change color. The script you and Chat GPT wrote would have had this same problem.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Changing the background colour of cells edited in the last 10 minutes

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.