Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Get HTML input into Google sheet in a specific format

The code snippet below is part of a larger script that collects user input from an HTML file and store these user input into my Google sheet. The type of input fields from the line formObject.firmenp all the way to the line formObject.zielplanung in my HTML file is date and have each their own specific ID. I want to get these dates in format day/month/year into my sheet.

Any idea or recommendation how to achieve that?

Thank you so much in advance for your help :).

function getFormValues(formObject){
  if(formObject.RecId && checkID(formObject.RecId)){
    var values = [[formObject.RecId.toString(),
    formObject.name,
    formObject.unternehmen,
    formObject.rufnummer,
    formObject.email,
    formObject.firmenp,
    formObject.onboarding,
    formObject.selbsttraining,
    formObject.crmm,
    formObject.tblock1,
    formObject.fdtblock,
    formObject.wochentraining,
    formObject.zielplanung,
    formObject.changestatus]];
  }else{
    var values = [[new Date().getTime().toString(),
    formObject.name,
    formObject.unternehmen,
    formObject.rufnummer,
    formObject.email,
    formObject.firmenp,
    formObject.onboarding,
    formObject.selbsttraining,
    formObject.crmm,
    formObject.tblock1,
    formObject.fdtblock,
    formObject.wochentraining,
    formObject.zielplanung,
    formObject.changestatus]];
  }
  return values;
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can make a function like the below and convert all your data using it. Use this function on your script page.

//2021-11-05


var getDate = document.getElementById("date").value;
console.log("Inputted data: " + getDate);

function getNewDateFormat(value){
  var dateValue = new Date(value);
  var monthPart = dateValue.getMonth() + 1;
  var dayPart = dateValue.getDate();
  var yearPart = dateValue.getFullYear();
  
  var newFormat = dayPart + "/" + monthPart + "/" + yearPart;
  
  return newFormat
}

console.log("Expected data: " + getNewDateFormat(getDate));
//dummy input 
<input type="text" id="date" value="2021-11-05" />

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!