I know that it's an old question, but I'll still add an answer to whom it may concern.
Generally speaking, Form
is connected to Sheet
, not to Spreadsheet
itself. So, one way to get all of the Spreadsheet
forms is to go through the Sheet
s of the Spreadsheets
, and get their Form URL, like that:
function getFormsOfSpreadsheet(spreadsheetId) {
const ss = SpreadsheetApp.openById(spreadsheetId);
const sheets = ss.getSheets();
const formsUrls = [];
for (const sheet of sheets) {
const formUrl = sheet.getFormUrl();
// getFormUrl() returns null if no form connected
if (formUrl) {
formsUrls.push(formUrl);
}
}
return formsUrls;
}
Docs
The other possible way is to get all of the Form
s in the Drive or in the Folder
, iterate through them to get their destination and compare it to your Spreadsheet
ID, like in this answer