I'm trying to create a registration form that can be imbedded into our club website for users to sign up to our sessions with.

I need the form to be updated via the back end database which i'll add triggers and data formating etc in due course.

My issue for now is the dates on sheets are displayed as i'd like "03-Jul" but once my script has run they appear on the form as a full date and timezone stamp. I'm sure i just need the script to treat the "date" as a string instead of a full date/time value. can anyone advise what to change in my script to achieve this please.


function main() {
      var labels = wsData.getRange(1,1,1,wsData.getLastColumn()).getValues()[0];
        var options = wsData
                      .getRange(2, i + 1,wsData.getLastRow()-1,1)
                      .map(function(o){ return o[0] })
                      .filter(function(o){ return o !== "" });

    function updateDropDownUsingTitle(title,values) {
      var items = form.getItems();
      var titles = items.map(function(item){
        return item.getTitle();
      var pos = titles.indexOf(title);
      if(pos !== -1){
        var item = items[pos];
        var itemID = item.getId();
    function updateDropDown(id,values){
      var item = form.getItemById(id);

enter image description here

1 Answer 1


Tl;Dr replace getValues() by getDisplayValues()


  • getValues() returns JavaScript Date objects for cells having a date, time, date-time and duration value. The value show in your form is the default conversion of the Date object into a string.
  • getDisplayValues() returns the cell displayed value as string.


  • Spot on!!! thanks, i knew it would be something simple :)
    – Lee Morris
    Jul 3, 2021 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.