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

200
Visualizações
Re-direct to a Google Form after running a Google App Script

I have created a Survey to collect information, and also wanted to collect the Geo location data.

I then created a Google App script which I have linked to the form with a link which is clicked by the user to run after completing the survey, this then adds the geo data into the same sheet.

after the script is run google displays text saying "this app was designed by a user and not google"

my question is, how can I let the script redirect them back to the form to submit another response, or at least to another html where they can click to submit a response again?

bellow is the current code I have for the script:

Gode.GS

function doGet() {
return HtmlService.createHtmlOutputFromFile("Index");
}function getLoc(value) {
var destId = FormApp.getActiveForm().getDestinationId() ;

var ss = SpreadsheetApp.openById(destId) ;
var respSheet = ss.getSheets()[0] ;
var data = respSheet.getDataRange().getValues() ;
var headers = data[0] ;
var numColumns = headers.length ;
var numResponses = data.length;
var c=value[0]; var d=value[1];
var e=c + "," + d ;
if (respSheet.getRange(1, numColumns).getValue()=="GeoAddress") {    
   respSheet.getRange(numResponses,numColumns-2).setValue(Utilities.formatDate
(new     Date(), "GMT+2", "dd/MM/yyyy HH:mm:ss"));
   respSheet.getRange(numResponses,numColumns-1).setValue(e);
   var response = Maps.newGeocoder().reverseGeocode(value[0], value[1]);
   f= response.results[0].formatted_address;
   respSheet.getRange(numResponses,numColumns).setValue(f);
 }
 else if (respSheet.getRange(1,numColumns).getValue()!="GeoAddress") {
   respSheet.getRange(1,numColumns+1).setValue("GeoStamp");
   respSheet.getRange(1,numColumns+2).setValue("GeoCode");
   respSheet.getRange(1,numColumns+3).setValue("GeoAddress");
 }
 }

Index.html

<!DOCTYPE html>
<html>
<script>
(function getLocation() {
if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(showPosition);
  }
})()      
function showPosition(position){
var a= position.coords.latitude;
var b= position.coords.longitude;
var c=[a,b]
getPos(c)
function getPos(value){
google.script.run.getLoc(value);
}
}
/script>
</html>

The script is running and collecting the data. I just want to add a clickable link to display to the users to submit another response, or even redirect them automatically to the same form

Would really appreciate advice on the next step!

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