admin管理员组文章数量:1327924
I have a form created in a Google Apps spreadsheet and I am trying to find out some of the forms parameter data in my script.
In the following code I don't understand why I am getting an 'Invalid argument' error at the line
var myForm = FormApp.openByUrl(formURL);
even though the log shows what I think is a valid formURL
string.
function myFunction() {
var ss = SpreadsheetApp.getActive();
var formURL = ss.getGetFormURL();
Logger.log('Spreadsheet\'s formURL: %s', formURL);
var myForm = FormApp.openByUrl(formURL); // Google script shows the ERROR here
Logger.log('Form PublishedURL: %s', myForm.getPublishedUrl());
}
I have a form created in a Google Apps spreadsheet and I am trying to find out some of the forms parameter data in my script.
In the following code I don't understand why I am getting an 'Invalid argument' error at the line
var myForm = FormApp.openByUrl(formURL);
even though the log shows what I think is a valid formURL
string.
function myFunction() {
var ss = SpreadsheetApp.getActive();
var formURL = ss.getGetFormURL();
Logger.log('Spreadsheet\'s formURL: %s', formURL);
var myForm = FormApp.openByUrl(formURL); // Google script shows the ERROR here
Logger.log('Form PublishedURL: %s', myForm.getPublishedUrl());
}
Share
Improve this question
edited Jun 26, 2020 at 20:45
Wicket
38.5k9 gold badges78 silver badges193 bronze badges
asked May 24, 2013 at 22:45
user2419137user2419137
611 silver badge3 bronze badges
2
- report issues/bugs here code.google./p/google-apps-script-issues/issues/list – eddyparkinson Commented May 27, 2013 at 13:49
-
1
Documentation says
openByUrl()
"Throws an exception if the URL is invalid or the user does not have permission to open the form." Did you check that permissions were set appropriately? – Mogsdad Commented May 27, 2013 at 15:56
2 Answers
Reset to default 4Try opening the form using its ID rather than the URL. You can find the ID of the form from its URL.
var myForm = FormApp.openById(id)
openById and openByUrl only works with the NEW forms service. So if form was created with old service, it won't work. See:
http://code.google./p/google-apps-script-issues/issues/detail?id=2866
版权声明:本文标题:javascript - Why do I get an 'Invalid argument: url' error in the openByUrl(formURL) call? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742254303a2441345.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论