timestamp on change value

Hi guys and gals!


I'm a systems administrator. As such I need to document passwords and access codes. To enforce password policies it would be handy to have a timestamp automatically update when I change a cell's value.


I currently have the date updating when I change the value of the cell. So far, so good. However, when I update one cell in the table, all timestamps get modified. This is not the intended functionality (at least according to me)


I have a cell which contains a NOW() function.

beneath this cell I have another cell which references the NOW() timestamp, and converts it to text using the T() function.


In the table where I need the timestamps, every row has this formula in the last column.

IF(LEN([RELATIVE cell containing password])>0,DATEVALUE([FIXED cell for timedate string)]),"never modified")


I would expect the cell containing this formula to individually update it's contents, but alass, it updates all timestamps in that table (and maybe even the document, haven't checked).


So the question is if I can achieve the intended functionality, or if I should file a feature request with Apple.

If any of you have any experience in this field your help is much appreciated.


I've searched the formula's, but was unable to find what I was looking for. Apple should really make a function for this though, in MySQL all you have to do is add a timestamp column, but somehow that's impossible for a spreadsheet application?

MacBook Pro, Mac OS X (10.7.4), Macbook Pro 8,1 8GB DDR3 120GB SSD

Posted on Jul 25, 2017 3:55 AM

Reply
7 replies

Aug 26, 2017 11:29 AM in response to Shaun Talbot

The script compares each new password to the old password and that row and, if they are not the same, it inserts the current date-time (the time the script is run). It is not a "real-time running list" in the sense that it updates the time stamp only when it is run.


I suggest actually trying it to see what it does. It takes a minute or so.


  1. Set up a Numbers table as in the example.
  2. Launch Script Editor (in Applications > Utilities).
  3. Copy-paste the script in the post above into Script Editor
  4. Click in the table.
  5. Click the triangle 'Run' button.


(The first time, you may need to check 'Script Editor.app' at System Preferences > Security & Privacy > Privacy > Accessibility).


If it does what you want you can put it in the Script Menu (so all you have to do is make a menu choice to run it rather than worrying about opening Script Editor) by following instructions here.


SG

Jul 25, 2017 4:52 AM in response to dmltv

Numbers does not have a timestamp function. You can do this manually by creating a small table (one row and one column) where the cell contains the formula:

=now()

User uploaded file


then when you modify a cell, go thru the steps to copy this time to the appropriate cell in the same row.

- change the state of the checkbox (to force the Numbers to update the time in cell A1)

- select the cell A1 in the table above

- copy

- select the destination

- paste using the menu item "Edit > Paste formula results" or use the

corresponding key combination <command> + <shift> + v


This method will capture the time at the time you copy the value in the single cell


It's not really what you want but Numbers does not really have the feature you want.


You can post feedback to Apple using the menu item "Numbers > Provide Numbers feedback"

Jul 25, 2017 8:28 AM in response to dmltv

Not as slick as what you can do in Excel but you can use a short script to help timestamp in Numbers.


You need an extra (hide it if you want) column to store older passwords, something like this:


User uploaded file


Then after editing a value or values in the Password column you can run the script below to update the Time Stamp column. To run it just copy-paste it into Script Editor (in your Applications > Utilities folder) and with the Numbers table selected click the triangle 'Run' button. You can put it in your menu or attach it to a keyboard shortcut if you want. Change the column numbers as needed.


Make sure 'Script Editor.app' is enabled at System Preferences > Security & Privacy > Privacy > Accessibility.


SG


set pwdCol to 1 -- column "A"

set oldCol to 2 -- column "B"

set timeStCol to 3 -- column "C"

tell application "Numbers"

tell front document's active sheet

tell (first table whose selection range's class is range)

repeat with r from 2 to row count

tell row r

if cell pwdCol's value is not cell oldCol's value then

set cell timeStCol's value to do shell script "date +'%Y-%m-%d %H:%M:%S'"

set cell oldCol's value to cell pwdCol's value

end if

end tell

end repeat

end tell

end tell

end tell

Aug 28, 2017 7:18 PM in response to Shaun Talbot

Hi Shaun,


Although SG's script doesn't provide a 'real time' updated time stamp, the lag is small enough to be insignificant in most cases.


I tested the script with an 1101 row table (1100 passwords), constructed on a simple pattern; a string of seven characters: abcdef1 in cell A2, then that string filled down the column. Numbers conveniently increments the number at the end of the text string. To keep all the passwords the same length, I edited the string by removing the initial letter each time the number increased by one place value (10, 100, 1000), then continued filling down the column.


Two runs of the script: the first to generate the initial entries in the "old PW" column and the time stamps showing the time that the script had written the oPW into that row. This involved 2200 writes, and took 120 seconds.


After filling all the 'old passwords' and time stamps, I edited the eleven that ended with the digits 50 by adding an a to the end of the string.


The second run of the script, which involved 1100 comparisons, but only 22 writes was completed in 3 seconds.


Not 'real time,' but very close.


The image is of the table, filtered to show only the rows where the current password ends with "a", "49" or "51", showing the time stamps from the initial run, or in the rows ending "a" from the second run.


User uploaded file


Regards,

Barry

Aug 28, 2017 8:43 PM in response to Barry

Thanks Barry, I like the detailed information, and I think I may be able to apply to my situation.


Rather than 2 PW to compare and log timestamp; my sheet has a checkbox. (From initial setup, I could generate a timestamp to correlate with a check. HOWEVER, on row 2, the new timestamp would propagate to the one above it. When the box is checked on row 3, it's timestamp would propagate to rows 2 & 1 (so same problem different situation).

User uploaded file

I've kind of been able to alter SGIII's script and instructions to my scenario, but at the moment can only seem to run it after the fact with each entry. Ultimately trying to prevent the 1st timestamp from being overwritten by another. Maybe there's a better way to write the script? Or better yet, a better way to write the formula in the first place. The concept is to check the box and generate an 'unalterable' timestamp.

User uploaded file User uploaded file

Aug 28, 2017 9:25 PM in response to SGIII

Thanks SGIII.

In my situation, I'm not necessarily comparing two rows together, but I'm still trying to generate a timestamp that will not be altered by the next successive time stamp. (problem)

User uploaded fileUser uploaded file


I've been able to alter your script, and apply to my scenario (thanks for the added instructions btw), but in order to make it work, it seems I have to run it with each entry after it is entered. If not, I go right back to the original problem.

User uploaded file

My research leaves me with the impression that there is really no way to achieve what I want through the normal formulas provided with "Numbers". Thus, I am now wading into script editor. I don't have any kind of handle on shell script, Apple script, or whatever script. And, once I figure out these 3 columns, I have to transpose the solution to a "checkout scenario" a few columns over. (Assuming I call out another set of columns and another if script). Is there a better way to write the script so that when I run it once, it work across and down the rows so that any new timestamp will not overwrite the previous times? And, embed this script when I turn this sheet into a template (so the user just needs to check the box and get the time)?


.... this is what I have so far:

User uploaded file

Aug 26, 2017 9:34 AM in response to SGIII

IGNORANT NEWBI WARNING: I've never used script editor, but kinda follow the command sequence. However, I'm trying to get timestamps connected to a column of checkbox (rapid collection of time stamps). In looking at the method, I am unclear as to whether your method will produce a real-time running list of timestamps, or an after the fact conversion that has to be manually applied by the user. Also, I don't even know where to insert the edited script! Would you please provide a little more direction for me, please.

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.

timestamp on change value

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