Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

118
Vistas
Replace linked Google Form URL in HTML sidebar when copying the spreadsheet

I would like to update the link of my google Form in the HTML code of the spreadsheet's sidebar automatically when the spreadsheet is copied since the form is also copied and linked to the new spreadsheet. I cannot use the same Form for this application.

Script to display the sidebar

//@OnlyCurrentDoc
function onOpen() {
 SpreadsheetApp.getUi().createMenu("👉blablabla👈").addItem("blablabla", "showSidebar").addToUi();
}

function showSidebar() {
 SpreadsheetApp.getUi().showSidebar(HtmlService.createHtmlOutputFromFile("Sidebar.html").setTitle("Remplir formulaire"));
}

HTML code:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <iframe src="https://docs.google.com/forms/xxxxxxxxxxxx" width="100%" height="595" frameborder="0" marginheight="0" marginwidth="0">Chargement…</iframe>
  </body>
</html>

I'm investigating to copy the URL from a random cell of the spreadsheet using the following script:

function GetUrlForm() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  return ss.getFormUrl();
}

but i can't get anything out of this. I've explored the "window.location" but I am not good enough to know how to use it.

I am really new to programming and any help would be really appreciated. I can drastically change the code wothout any problem if needed.

Thank you kindly !

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Looks like you want to update the src parameter of the iframe. I recommend you to add an id attribute to the iframe in your HTML to make it easier to reference.

<iframe id="myId" src="https://docs.google.com/forms/xxxxxxxxxxxx" width="100%" height="595" frameborder="0" marginheight="0" marginwidth="0">Chargement…</iframe>

Then you can update the src parameter of the iframe after your retrieve the URL, this will automatically reload the frame.

function updateFrame(src){
  document.getElementById("myId").src = src; 
}

You can see: https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/src

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda