Google-sheets – Create a custom DateTimePicker in Google Sheets

google sheetsgoogle-apps-script

In a sheet I have a column to enter a datetime value that would later be checked by a script to create a trigger.
I would like to set a picker in that column to ease selection and avoid errors.

I know Google Sheets offers an option in Data Validation for date but not for time neither datetime.

However, I found this class in the Google Apps Script API

https://developers.google.com/apps-script/reference/card-service/date-time-picker

But I just do not know how to implement it in a sheet (e.g. with OnEdit() or SetDataValidation()) so any time I press enter any cell in that column the picker is called to select datetime and set cell value to that selection.

Best Answer

The referred class belongs to the Card Service which is only available for G Suite add-ons.

To build a custom date picker for Google Sheets you could use the HTML Service. For further details see https://developers.google.com/apps-script/guides/html