Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting static time on sheets app

I'm trying to insert the current time as a static value in Google sheets on a mobile device.

The keyboard shortcut Ctrl + Shift + ; works on the desktop but not the mobile app and "=NOW()" works to insert the time but as a dynamic value.

Is there a script I can use to cut and paste the dynamic value as a static value?

like image 316
user3776107 Avatar asked Jun 25 '14 16:06

user3776107


People also ask

How do I create a static timestamp in Google Sheets?

Insert Timestamp in Google Sheets For static timestamps, you can also use CTRL + ; and CTRL + : to insert the date or time. However, Google Sheets has a keyboard shortcut that Excel doesn't – CTRL + ALT + SHIFT + ; (Control Alt Shift Semicolon). This inserts a static date and time into the selected cell.

How do I insert time in Google Sheets mobile?

Insert Current Time in Google Sheets Using NOW You can use this function by typing =NOW() into the required cell. It's important to note that this function will update the timestamp only when you change the document.


1 Answers

On a mobile app, none of the script-based UI extensions will be visible, but if you're willing to use the full web interface on your device (ouch), you could add a menu or sidebar add-on that inserts the current time into the active cell.

Here's a hack that watches for specific text being added to a cell, then updates the content with the current date. (You can format the cell to display time instead.) Just put #datetime in any cell, and watch it be replaced. Note though, that this only works for EDITs, not other types of changes. Tested with Sheets app on iOS7.2, and it works.

/**
 * onEdit trigger function is called whenever text is edited in
 * the spreadsheet.
 *
 * If the content criteria is met, content will be replaced with
 * current time.
 */
function onEdit(e) {
  if (e.value.toUpperCase() == '#DATETIME') {
    e.range.setValue(new Date());
  }
}
like image 73
Mogsdad Avatar answered Oct 01 '22 03:10

Mogsdad