Skip to content

Instantly share code, notes, and snippets.

@Max-Makhrov
Created May 19, 2020
Embed
What would you like to do?
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