Input UTC / GMT Time into Numbers cell

Hello,


I would like to be able to establish a cell E1 in Numbers that is set to UTC / GMT time regardless of my location in the world which changes regularly.


Is there a way of importing this data like currencies or stock price data ?


I am creating a spreadsheet that will be a reference for another spreadsheet.


Thank you


Scott

MacBook Pro 15″, macOS 12.3

Posted on Apr 24, 2022 1:28 AM

Reply
Question marked as Top-ranking reply

Posted on Apr 24, 2022 8:40 AM

Your screenshot suggests you're running Numbers on an iPad. But just in case you run it on a Mac as well you can set up a shortcut like this in the Shortcuts app and assign a shortcut to it or have it as a menu item.




The JavaScript, in which you'd need to change the document name, etc, to exactly match your setup, is:


const utctime = new Date().toISOString().split("T")[1].split(".")[0], 
      app = Application('Numbers'),
      doc = app.documents['MyTestDocument.numbers'],
      sheet= doc.sheets['Time Record'],
      table = sheet.tables['Coordinated Universal Time (UTC)'],
      cell = table.cells['E2'];
cell.value = utctime;



On the iPad there appears to be a way to get UTC but no way to insert it into a specific cell. The closest you could get would be to have it inserted in a new row at the bottom of a designated table. Referencing that last row in formulas would be possible, but kludgy.



SG

3 replies
Question marked as Top-ranking reply

Apr 24, 2022 8:40 AM in response to larrup

Your screenshot suggests you're running Numbers on an iPad. But just in case you run it on a Mac as well you can set up a shortcut like this in the Shortcuts app and assign a shortcut to it or have it as a menu item.




The JavaScript, in which you'd need to change the document name, etc, to exactly match your setup, is:


const utctime = new Date().toISOString().split("T")[1].split(".")[0], 
      app = Application('Numbers'),
      doc = app.documents['MyTestDocument.numbers'],
      sheet= doc.sheets['Time Record'],
      table = sheet.tables['Coordinated Universal Time (UTC)'],
      cell = table.cells['E2'];
cell.value = utctime;



On the iPad there appears to be a way to get UTC but no way to insert it into a specific cell. The closest you could get would be to have it inserted in a new row at the bottom of a designated table. Referencing that last row in formulas would be possible, but kludgy.



SG

Apr 24, 2022 4:27 AM in response to larrup

larrup wrote:

I would like to be able to establish a cell E1 in Numbers that is set to UTC / GMT time regardless of my location in the world which changes regularly.

Is there a way of importing this data like currencies or stock price data ?


Good question! I don't think there is a formula that can do what you want. It should be possible via a script, possibly included in the Shortcuts app, but you would have to trigger that manually each time you want to update E1.


SG

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.

Input UTC / GMT Time into Numbers cell

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