0

I'm using Zapier to update a google sheet every time a new order gets placed, where a new row gets created.

For example

COL A  | COL B 
-------------
Sku No | 

I'd like COL B to have the time stamp every time a row is created.

I have tried this script but it only works on edit that is, if the cell is manually edited.

function timestamp() {
  var s = SpreadsheetApp.getActiveSheet();
  if( s.getName() == "Order Details" ) { //checks that we're on the correct sheet
    var r = s.getActiveCell();
    if( r.getColumn() == 4 ) { //checks the column
      var nextCell = r.offset(0, -2);
      if( nextCell.getValue() === '' ) //is empty?
        nextCell.setValue(new Date());
    }
  }
}

I have seen come across examples that I now cannot refer back to, where a unique keyword used in a cell inserts a static timestamp when used with a script.

How can this be done? Any help is appreciated.

user2240778
  • 309
  • 5
  • 16
  • The simplest solution is to have Zapier write the time as well, yes? Or have Zapier activate some webapp link? Have you checked if Zapier's updates trigger the `on change` event? – tehhowch Sep 02 '18 at 19:17

1 Answers1

0

I used a combination of having zapier write a timestamp using {{zap_meta_utc_iso}} in this article - which outputs YYYY-MM-DD HH:MM:SS

and then used this article to auto format the date to dd/mm/yyyy HH:MM:SS

user2240778
  • 309
  • 5
  • 16