Search code examples
google-apps-scriptgoogle-apps

How do I write data from a google spreadsheet into a time input field in a templated html file


I am using a form in a templated html file to put data into a spreadsheet. The reason for the templated html is so that I can put the data from the spreadsheet back into the form to view and edit it.

Here is the code from the html file

<input type="time" name="Start Time" id="Start Time" value="<?=data[0].startTime?>">

To get the data into the spreadsheet, the spreadsheet column appears to need to be set to time or duration. But to get the data back into the form it needs to be in plain text (so I guess I need to stringify the input data when it goes to the spreadsheet) Is there any other way around this?

With date inputs I just needed to make sure the field was set to plain text, so I figured it would be the same with time.

Thanks


Solution

  • Set spreadsheet columns to plain text, and add type="string" to the input field so that it doesn't default to some time format.