Search code examples
google-apps-scriptformattinggoogle-sheetsrowspropagation

Google Sheets - propagate column date formatting to new rows


The date format in the column is not propagating to new rows, whenever new rows are being added to the bottom of the sheet. The column formatting is not automatically applied - this in regards to date, currency format, alignment etc.


Solution

  • Create a function that will run when the form is submitted:

    Managing Triggers Manually - Google Documenation

    Code.gs

    function respondToFormSubmit() {
      //Format entire columns
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var sheet = ss.getSheets()[0];
      var range = sheet.getRange("M:Y");
    
      range.setNumberFormat('dd.mm');
    };