jsoma / tabletop

Tabletop.js gives spreadsheets legs
MIT License
3.77k stars 444 forks source link

Trouble accessing specific sheet data #182

Closed cheelay closed 4 years ago

cheelay commented 4 years ago

When I set simpleSheet: true, I am able to append data with code like this:

$(".dataRank").append(data[0].Rank);

But when I set simpleSheet: false, I get an error when I try to append data with code like this:

$(".dataRank").append(tabletop.sheets("HW")[0].Rank);

The error I receive is: "Uncaught (in promise) TypeError: Cannot read property 'sheets' of undefined".

I am quite new to coding, so any guidance would be appreciated.

cheelay commented 4 years ago

I can access multiple worksheet data with code like:

$(".dataRank").append(data.HW.elements[0].Rank);

That's good enough for me. I just wondered why the .sheets function wasn't working.

jsoma commented 4 years ago

Not quite sure but it's possibly because when you created your callback, you used function(data) and forgot to adjust it to function(data, tabletop). Glad you got it working!