3
var vGlobals = {
    dataString: "nuu"
};



Tabletop.init( { key: 'sfas234asefasdy569xbhxcvnvc',
                       callback: showInfo,
                       simpleSheet: true } )

    function showInfo(data, tabletop) {
           vGlobals.dataString = utf8.encode(base64.encode(data));
    }

    showInfo();

How do I access the data variable (first parameter in showInfo), so I can make the function call in the last line of the code? The showInfo function is a function in the npm module of tabletop.js.

  • How do you access data? "data" is something you will have to pass to showInfo right? What do you mean by accessing? – Bhargav Ponnapalli Apr 21 '16 at 14:46
  • Yes, that's my question. How do I pass it to the showInfo below? When I just pass "data" it says it's undefined. – Denise Hyacinth Soco Apr 21 '16 at 14:47
  • You are not supposed to call showInfo directly. You pass it as a callback to Tabletop, and it will be called by Tabletop when the document has been parsed. – Henrik Solgaard Apr 21 '16 at 15:26
  • Try putting "console.log(data);" inside showInfo and see if you get any output in the developer console in the browser. – Henrik Solgaard Apr 21 '16 at 15:29
  • The request Tabletop makes to get the spreadsheet fails with a 400 (bad request) response code. It is probably because the key is wrong or the document is not public. You can try passing the full public URL to the document instead of just the key as the value for the key attribute. – Henrik Solgaard Apr 21 '16 at 15:45

0 Answers0