• Numbers: is there a way to autopopulate with save time?

    From Ian McCall@21:1/5 to All on Mon Nov 14 15:32:45 2022
    I’d like to auto update a cell with the date on which the document was last saved. I know I can find the information elsewhere, it would just be
    convenient to have it front and centre on this particular sheet.

    Not sure there will be, but is there a way of programatically getting that saved date so I can populate accordingly?

    Cheers,
    Ian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bruce Horrocks@21:1/5 to Ian McCall on Mon Nov 14 23:30:37 2022
    On 14/11/2022 15:32, Ian McCall wrote:
    I’d like to auto update a cell with the date on which the document was last saved. I know I can find the information elsewhere, it would just be convenient to have it front and centre on this particular sheet.

    Not sure there will be, but is there a way of programatically getting that saved date so I can populate accordingly?

    I don't think you can do it programmatically from within Numbers e.g. by
    using some sort of formula, but you can do it using AppleScript.


    tell application "Numbers" to tell front document to set thePath to its file tell application "Finder" to set modDate to modification date of file
    thePath
    tell application "Numbers"
    tell active sheet's first table of front document
    set value of cell 2 of column "B" to modDate
    end tell
    end tell


    Regards,
    --
    Bruce Horrocks
    Surrey, England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Ridd@21:1/5 to Bruce Horrocks on Tue Nov 15 08:04:11 2022
    On 14/11/2022 23:30, Bruce Horrocks wrote:
    On 14/11/2022 15:32, Ian McCall wrote:
    I’d like to auto update a cell with the date on which the document was
    last
    saved. I know I can find the information elsewhere, it would just be
    convenient to have it front and centre on this particular sheet.

    Not sure there will be, but is there a way of programatically getting
    that
    saved date so I can populate accordingly?

    I don't think you can do it programmatically from within Numbers e.g. by using some sort of formula, but you can do it using AppleScript.


    tell application "Numbers" to tell front document to set thePath to its
    file
    tell application "Finder" to set modDate to modification date of file
    thePath
    tell application "Numbers"
        tell active sheet's first table of front document
            set value of cell 2 of column "B" to modDate
        end tell
    end tell

    The closest formula I can find inside Numbers is NOW() which works, but
    every time you make an edit (even without saving) it updates.

    --
    Chris

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Graham J@21:1/5 to Chris Ridd on Tue Nov 15 08:33:50 2022
    Chris Ridd wrote:

    [snip]

    The closest formula I can find inside Numbers is NOW() which works, but
    every time you make an edit (even without saving) it updates.


    That ought to be OK.

    If you make an edit, what you see on the screen updates. But if you
    close the file without saving then surely the file is not changed, and therefore retains the original value.

    Compare that with MS Word, where opening a document that has a date
    configured as "update automatically" the date changes as soon as you
    open the ducument - very confusing when perhaps your reason for opening
    the document is to see when you last modified it ...


    --
    Graham J

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ian McCall@21:1/5 to Graham J on Tue Nov 15 09:37:57 2022
    On 15 Nov 2022, Graham J wrote
    (in article <tkviu8$219kr$[email protected]>):

    Chris Ridd wrote:

    [snip]

    The closest formula I can find inside Numbers is NOW() which works, but every time you make an edit (even without saving) it updates.

    That ought to be OK.

    If you make an edit, what you see on the screen updates. But if you
    close the file without saving then surely the file is not changed, and therefore retains the original value.

    Compare that with MS Word, where opening a document that has a date configured as "update automatically" the date changes as soon as you
    open the ducument - very confusing when perhaps your reason for opening
    the document is to see when you last modified it ...

    Yep - that actually makes some sense. I have a sheet of standing
    orders/direct debits etc. and I want to know how fresh the data I’m looking at is. In other words I don’t want to open a sheet I last updated 8 months ago and think I’m looking at the current set of data.

    That would do fine then I think - cheers.

    Ian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Graeme Wall@21:1/5 to Chris Ridd on Tue Nov 15 10:54:31 2022
    On 15/11/2022 08:04, Chris Ridd wrote:
    On 14/11/2022 23:30, Bruce Horrocks wrote:
    On 14/11/2022 15:32, Ian McCall wrote:
    I’d like to auto update a cell with the date on which the document
    was last
    saved. I know I can find the information elsewhere, it would just be
    convenient to have it front and centre on this particular sheet.

    Not sure there will be, but is there a way of programatically getting
    that
    saved date so I can populate accordingly?

    I don't think you can do it programmatically from within Numbers e.g.
    by using some sort of formula, but you can do it using AppleScript.


    tell application "Numbers" to tell front document to set thePath to
    its file
    tell application "Finder" to set modDate to modification date of file
    thePath
    tell application "Numbers"
         tell active sheet's first table of front document
             set value of cell 2 of column "B" to modDate
         end tell
    end tell

    The closest formula I can find inside Numbers is NOW() which works, but
    every time you make an edit (even without saving) it updates.


    Surely that would do, after all the latest date would be the date saved.

    --
    Graeme Wall
    This account not read.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Ridd@21:1/5 to Graham J on Tue Nov 15 22:01:28 2022
    On 15/11/2022 08:33, Graham J wrote:
    Chris Ridd wrote:

    [snip]

    The closest formula I can find inside Numbers is NOW() which works,
    but every time you make an edit (even without saving) it updates.


    That ought to be OK.

    If you make an edit, what you see on the screen updates.  But if you
    close the file without saving then surely the file is not changed, and therefore retains the original value.

    Alas, no.

    The built-in docs describe how it works:

    Notes
    The NOW function does not have any arguments. However, you must include the brackets.

    The displayed date and time are updated every time you open the file or change a table.

    The time zone for a local macOS file: The file’s time zone matches the time zone in the Date & Time preferences on the Mac when the file was last saved.

    The time zone for a local iOS or iPadOS file: The file’s time zone matches the time zone in your Date & Time settings when the file is opened or saved.

    The time zone for an iCloud file: The file’s time zone matches the time zone in iCloud settings when the file is first created. If the file is opened and saved in a local app (not in iCloud), the time zone is updated to match the settings on the
    device where the app is located.

    The time zone for a file shared with collaborators: The file’s time zone continues to match the time zone in iCloud settings where the file was first shared, unless you unshare it and save it in a local app (not in iCloud).

    To use NOW as a static date and time stamp, you can select a cell that contains it, choose Edit > Copy, select the cell where you want the time stamp, then choose Edit > Paste Formula Results to paste the date and time as static (unchanging) text.


    I think you'd better break out Bruce's Applescript!

    --
    Chris

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)