sorry if my question is answered somewhere else, I've been looking for answers on google all afternoon but I'm still too newbie. 

I'm trying to use Google spreadsheets' scripts to access to a different spreadsheet. 
The only information I have is the spreadsheet's URL, where it has the key and the gid (some kind of chronological index for multi-sheet spreadsheets - only information i could find is [here](https://developers.google.com/chart/interactive/docs/spreadsheets)). 

The sheet URL is something like `https://docs.google.com/spreadsheet/ccc?key=abc123#gid=178`
And the sheet it links to is the first sheet in the spreadsheet.

How do I find the sheet that maches the `gid`?

The following doesn't work, since it's based on the sheets' order, not the time they are created:

```
var ss = SpreadsheetApp.openById("abc123");

var sheet = ss.getSheets();
Browser.msgBox(sheets[178].getIndex());

```