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

209
Views
Configuración de un destino de formulario de Google para sus respuestas a través de un script de Google

Estoy tratando de configurar un script que cree un formulario basado en una hoja (que funciona), luego quiero que envíe las respuestas a una hoja específica para que los scripts interactúen con él, conectando manualmente los formularios a la hoja no será práctico ya que se pueden crear formularios múltiples todos los días

cuando ejecuto el script aparece este código de error

Excepción: error inesperado al obtener el método o la propiedad setDestination en el objeto FormApp.Form.

a continuación está mi código, cualquier ayuda será apropiada

 function bug() { var sheet = SpreadsheetApp.getActive().getSheetByName('TC'); var value = sheet.getRange("A3").getValue(); var em = sheet.getRange("B3").getValue(); var cos = sheet.getRange("E3").getValue(); var name = sheet.getRange("D3").getValue(); var sup = sheet.getRange("C3").getValue(); var form = FormApp.create(value); var item = form.addMultipleChoiceItem(); item.setHelpText("Name: " + name + "\n\nEmail: " + em + "\n\nQuote No: " + value + "\n\nProject: " + sup + "\n\nTotal Cost: " + cos + "\n\nBy selecting approve you agree to the cost and timeframe specified by the quote and that the details above are correct") .setChoices([item.createChoice('Approve'), item.createChoice('Deny')]); var item = form.addCheckboxItem(); item.setTitle('What extras would you like to add on?'); item.setChoices([ item.createChoice('Damp-Course'), item.createChoice('Wrap'), item.createChoice('Taco') ]); Logger.log('Published URL: ' + form.getPublishedUrl()); Logger.log('Editor URL: ' + form.getEditUrl()); Logger.log('ID: ' + form.getId()); var ssId = sheet.getSheetId(); form.setDestination(FormApp.DestinationType.SPREADSHEET, ssId); var SendTo = "insertgenertic@email.com"; var link = form.getPublishedUrl(); var message = "Please follow the link to accept you Quotation " + form.getPublishedUrl(); //set subject line var Subject = 'Quote' + value + 'Confirmation'; const recipient = em; const subject = "Confirmation of order" const url = link GmailApp.sendEmail(recipient, subject, message); }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

No puede enviar respuestas de formulario a una hoja existente previamente. Cuando vincula su formulario a una hoja de cálculo de destino, siempre creará una nueva hoja para almacenar esas respuestas, sin importar si usa Apps Script para establecer el destino. Solo puede elegir si será una hoja de cálculo existente o una nueva.

Debido a esto, debe proporcionar la identificación de la hoja de cálculo cuando llame a Form.setDestination(type, id) . Como está proporcionando la identificación de la hoja en su lugar, está recibiendo un error.

Deberías hacer algo como esto:

 function bug() { // ... const spreadsheetId = SpreadsheetApp.getActive().getId(); form.setDestination(FormApp.DestinationType.SPREADSHEET, spreadsheetId); // ... }

Relacionado:

  • Vincule las respuestas del formulario de Google a la pestaña de hoja de cálculo de Google ya existente
  • Elija dónde guardar las respuestas del formulario
about 4 years ago · Juan Pablo Isaza Report

0

form.setDestination(FormApp.DestinationType.SPREADSHEET, ssId);

Se supone que ssId es la identificación de una hoja de cálculo, no una hoja

ejemplo

identificación de la hoja de cálculo

obtenerIdHoja

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!