A bit more flexibility in getting the right sheet id.

I ran into a case where the the links array was more than 4 items and thus getting the sheet id based on that broke.  This adds a bit more flexibility, though is still pretty brittle.