我在Google電子表格的一列中列出了Google表單。我需要獲取每個表單響應目標的電子表格選項卡的名稱。如何使用Apps腳本獲取Google表單目標的電子表格名稱
在該的形式在列表上運行循環,我使用
for(i = 1; i < length-of-thelist, i++) {
var form = FormApp.openByUrl(url); //Line1
var destId = form.getDestinationId(); //Line2
var sheetName = SpreadsheetApp.openById(destId).getSheetName(); //Line3
//..... other lines to print the sheet name ......
}
在第1行,我傳遞作爲URL的形式列表的每個單元格的項目。
但是這給了我一個錯誤「沒有找到給定ID的項目,或者您沒有權限訪問它。」這發生在Line1上。
錯誤的第二部分(「您沒有權限...」)不是真實的,因爲我是表單的所有者,它包含表單列表以及表單本身。
有沒有辦法讓我得到這個?
我會避免在變量名稱破折號 - 它使代碼相當尷尬閱讀。 – Ryan
謝謝瑞恩。感謝您的反饋! – Krishna
感謝Rubén對編輯。 – Krishna