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

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

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 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