Question: I have a list of Google Forms in a column in a Google spreadsheet. And I need to get the name of the spreadsheet tab that is the response destination for each of the forms. 

In a for loop that runs on the list of the forms, i am using 

```
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 ......

}

```

On line 1, i am passing as the url the item of each cell of the list of the forms. 

But this gives me an error "No item with the given ID could be found, or you do not have permission to access it." And this happens on Line1. 

The second part of the error ("you do not have permission...") is not true because i am the owner of the sheet that contains the list of forms as well as the forms themselves. 

Is there is a way that i can get this?

Answer: 
Unfortunately the method getDestinationId() returns the id of the spreadsheet not the specific sheet the form is bound to. What I would recommend you do is store the sheet name or id along with the form ids you've listed then you can loop over those rows and retrieve the appropriate sheet name/id as needed.
I have built this and seems to be working. 

```
function destinationTabName() {
   var master_file = DriveApp.getFileById('1zwTluWabUdHxxxxxxxxxxxxxxx'); //reading the active spreadsheet
   var master_doc_id = master_file.getId(); //getting the file id

   var ss = SpreadsheetApp.openById(master_doc_id);
   SpreadsheetApp.setActiveSpreadsheet(ss);

   var sheet = ss.getSheetByName("Sheet1"); // Let us assume Sheet1 is the name of the tab in which we want to output the name of the tab which is the form destination 
   var sheetArray = sheet.getDataRange().getValues();

  var sheets = ss.getSheets();
  sheet.getRange(sheetArray.length+1, column#).setValue(sheets[0].getName()); 

}

```

Please note that sheets[0] works in this case because i'm generating the form destination using form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId()); This creates a tab by name 'Form Responses xx' which is invariably the first tab in the spreadsheet. So, by extension, the above code works properly only when it is run before any changes to the order of the tabs in the sheet is done (intentionally, or by design or accidentally). 

Also please note that i'm forced to use a separate function like this because the function that contains form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId()) is giving an error that forces the sheet to reload. When this happens, the functionality contained in the destinationTabName() function actually is registering an earlier tab in the sheet as sheets[0].

But overall, the workaround works for me for now. 

Note: In the non-code area, when i say "Sheet", i mean the entire Google Sheets workbook. "Tab" = the individual tabs of the workbook.