Skip to content

Instantly share code, notes, and snippets.

@Max-Makhrov
Created May 19, 2020 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Max-Makhrov/fecdc2ba0c05c9efdbe1db8e21d3ff01 to your computer and use it in GitHub Desktop.
Save Max-Makhrov/fecdc2ba0c05c9efdbe1db8e21d3ff01 to your computer and use it in GitHub Desktop.
Embed Google Form into Google Apps-Script HTML-Form
function launchTheForm_() {
// create a form-template object
let html = HtmlService.createTemplateFromFile('form').evaluate().setWidth(650).setHeight(1331);
// show the form to user
SpreadsheetApp.getUi().showModalDialog(html, ' ');
}
function onOpen() {
var ui = SpreadsheetApp.getUi();
// Or DocumentApp or FormApp.
ui.createMenu('My Form')
.addItem('Show', 'launchTheForm_')
.addToUi();
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<!-- https://stackoverflow.com/questions/37688873/responsive-iframe-with-fixed-div-beneath-it -->
<style>
.iframe-wrapper{
position:fixed;
top:0;left:0;right:0;bottom:50px;
}
.iframe-wrapper iframe{
width:100%;
height:100%;
border:none;
}
</style>
</head>
<body>
<div class="iframe-wrapper">
<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSfuEEIPLCNknDj3yhoNrDrCPt2tEEhbtmtt3Wwrw4qmV20IPA/viewform?embedded=true" width="640" height="1331" frameborder="0" marginheight="0" marginwidth="0">Loading…</iframe>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment