Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda