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());
}
Try 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.com/p/google-apps-script-issues/issues/detail?id=2866
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With