-
-
Save oshliaer/f5ca7d53b52c14d2fd17c7950cbfd14f to your computer and use it in GitHub Desktop.
Google Form In Modal Dialog of Google Spreadsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Global | |
*/ | |
var width = 1000; | |
var height = 700; | |
function onOpen() { | |
SpreadsheetApp.getUi().createMenu('Form in Sheet').addItem('Lunch the Form', 'lunch').addToUi(); | |
} | |
function lunch(){ | |
var hs = HtmlService.createTemplateFromFile('ModalDialog'); | |
hs.width = width; | |
hs.height = height; | |
hs.publishedUrl = SpreadsheetApp.getActiveSpreadsheet().getFormUrl(); | |
var userInterface = hs.evaluate() | |
.setWidth(width) | |
.setHeight(height); | |
SpreadsheetApp.getUi().showModalDialog(userInterface, 'Form'); | |
} | |
function getSize(type){ | |
if(type === 'width') | |
return width - 20; | |
if(type === 'height') | |
return height - 20; | |
return 600; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<base target="_top"> | |
</head> | |
<body> | |
<iframe src="<?= publishedUrl; ?>?embedded=true" width="<?= getSize('width'); ?>" height="<?= getSize('height'); ?>" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment