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

162
Views
Error al importar datos del área de texto en el cuadro de diálogo a la hoja de cálculo de Google

Tengo un cuadro de diálogo en el que hay un área de texto y un botón Insertar para importar datos del área de texto a la hoja de cálculo de Google. Aquí está el código:

 <td><button style="width:40%" onclick="insert();google.script.run.onEdit();">Insert</button></td>

Aquí está el código html

 function insert() { var title = document.getElementById('Qnumber').value; var content1 = document.getElementById('content').value; var content = replaceContent(content1); var formula1 = document.getElementById('formula').value; var formula = replaceFormula(content1,formula1) var unit = document.getElementById('unit').value; var option1 = document.getElementById('A').value; var option2 = document.getElementById('B').value; var option3 = document.getElementById('C').value; var option4 = document.getElementById('D').value; if (document.getElementById('formula').value !=="") { google.script.run.enterName1(title,content,formula,unit); } else { google.script.run.enterName2(title,content,option1,option2,option3,option4); } }

Aquí está el código gs

 function enterName1(title,content,formula,unit) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sh = ss.getSheetByName('tests'); var title = sh.getRange(Number(title)+1,1,1,3).setFormulas([[title, '="'+content+'"', '=round('+formula+';3)'+'&" '+unit+'."']]); } function enterName2(title,content,option1,option2,option3,option4){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var sh = ss.getSheetByName('tests'); var title = sh.getRange(Number(title)+1,1,1,3).setFormulas([[title, '="'+content+'"', '=if(column()=3;"'+option1+'";if(column()=4;"'+option2+'";if(column()=5;"'+option3+'";if(column()=6;"'+option4+'"))))']]); }

Cuando ejecuto el programa, la función "enterName1" funciona y la función "enterName2" no. Alguien me puede ayudar a solucionarlo, gracias.

about 4 years ago · Juan Pablo Isaza
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!