0

I am getting an error in my code.gs at very line 3 of code -

// function to find the form id
function findFormIDs() {
  var form = FormApp.openById("my spreadsheet id");
}

error message is "Exception: Invalid ID (line 3, file "Code")" I am confident that the spreadsheet ID I am passing is 100% correct. I have tried these creating new spreadsheets but getting the same error for each new spreadsheet.

Any debugging I can perform?

2
  • 2
    If you want to open a spreadsheet you would have to use SpreadsheetApp instead of FormApp. If you want to open the Form you would need the id of the form, not the spreadsheet. Commented Aug 31, 2020 at 11:06
  • For documentation reasons please accept the answer or provide your feedback in order to modify it and solve your question. Commented Sep 6, 2020 at 10:25

1 Answer 1

1

Be sure to pass the correct type id to the respective class:

You should either call this to get a reference to the spreadsheet:

function findSpreadsheet() {
  var spreadsheet= SpreadsheetApp.openById("my spreadsheet id");
}

or this to get a reference to the form:

function findForm() {
  var form = FormApp.openById("my form id");
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.