Hi following Tanaike's answer here , I was able to successfully implement a form into a pop-up window in my google sheet, however when another user (that I've set as editor attempt to open this pop up I get this error message:
"You do not have access to perform that action. Please ask the owner of this item to grant access to you."
It is not clear how I can grant further access to this second user as he's already set as editor.
Here is the script I trigger:
function launchForm() { var formTitle = ''; var formID = '14uZANF9q3FKQvfLD1Qx-enYdeQ_pxzORTeHwSSKtHOk'; var form = FormApp.openById(formID); var formUrl = form.getPublishedUrl(); var htmlApp = HtmlService .createHtmlOutput('<script>location.href = "' + formUrl + '"</script>') .setSandboxMode(HtmlService.SandboxMode.IFRAME) .setTitle(formTitle) .setWidth(900) .setHeight(750); SpreadsheetApp.getActiveSpreadsheet().show(htmlApp); } function onOpen() { var sheet = SpreadsheetApp.getActiveSpreadsheet(); var entries = [{ name : "Launch Form", functionName : "launchForm" }]; sheet.addMenu("Custom Menu", entries); };
I've actually found an alternative which solved my problem. In case anyone face the same issue, here is what I did:
function myForm() {
var html = HtmlService.createHtmlOutputFromFile('myForm')
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
SpreadsheetApp.getUi()
.showModalDialog(html, 'Hello');
}
and created a HTML file:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<iframe src="..." width="500" height="500" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe> </body>
</html>
Note: you can find the iframe tag when you go to edit your form in Google form > and click Send > click tab Embed HTML
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.