title: How to insert the current date time into a google sheet, respecting the sheet's timezone, using sheets api v4?
body: <p>I've been trying to insert the current date time into a google sheet from sheets api v4 for hours now. I can't believe how difficult this is to figure out!</p>
  
  <p>So far I've found that:</p>
  
  <p><code>Js date object</code> won't work as google sheets uses a different epoch (one that apparently changes depending on mac vs win). I have been unable to find any library that can create this google sheets/excel date serial number. If I could that might work.</p>
  
  <p>If I format the Js date object as a string and send it to the sheet, the timezone is incorrect due to server location (where sheets api is running) vs user location (where the sheet is being used).</p>
  
  <p>I considered converting the Js Date object to the user's timezone but google sheets doesn't spit out a <code>GMT</code> or <code>UTC</code> value it uses <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#spreadsheetproperties" rel="nofollow noreferrer">CLDR</a>. So far I haven't found anyway to use that information to convert the timezone.</p>
  
  <blockquote>
    <p>The time zone of the spreadsheet, in CLDR format such as America/New_York. If the time zone isn't recognized, this may be a custom time zone such as GMT-07:00.</p>
  </blockquote>
  
  <p>If I send the cell <code>updateRequest</code> using <code>=NOW()</code> as the value the date time is correct. But it updates every time the spreadsheet is edited ... which is unusable as a timestamp for a row submission. Wish you could turn that off!</p>
  
  <p>So in summary, I would like to let google sheets create the date since it knows about the timezone of the user. Surely there is a way to just enter a date with sheets api that respects the users timezone right?? If not what are my options?</p>