bassarisse / google-spreadsheet-to-json

Simple tool to export Google Spreadsheets to JSON files, though Node API or CLI
The Unlicense
134 stars 33 forks source link

Cannot read property 'reduce' of undefined #1

Closed jmatsushita closed 8 years ago

jmatsushita commented 8 years ago

Hi there,

Just tried to use our tool but it didn't work on the public spreadsheet with this command and results in the error message below. I'm using node v4.2.2.

gsjson 1j2hl7TlGGoKmO5EVkibU1LASk9p1ncmimI7-26JFX1g projects.json

Any ideas?

Jun

events.js:141
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'reduce' of undefined
    at /usr/local/lib/node_modules/google-spreadsheet-to-json/gsjson.js:77:37
    at /usr/local/lib/node_modules/google-spreadsheet-to-json/node_modules/google-spreadsheet/index.js:222:7
    at /usr/local/lib/node_modules/google-spreadsheet-to-json/node_modules/google-spreadsheet/index.js:118:11
    at Parser.<anonymous> (/usr/local/lib/node_modules/google-spreadsheet-to-json/node_modules/google-spreadsheet/node_modules/xml2js/lib/xml2js.js:484:18)
    at emitOne (events.js:77:13)
    at Parser.emit (events.js:169:7)
    at Object.onclosetag (/usr/local/lib/node_modules/google-spreadsheet-to-json/node_modules/google-spreadsheet/node_modules/xml2js/lib/xml2js.js:445:26)
    at emit (/usr/local/lib/node_modules/google-spreadsheet-to-json/node_modules/google-spreadsheet/node_modules/xml2js/node_modules/sax/lib/sax.js:639:35)
    at emitNode (/usr/local/lib/node_modules/google-spreadsheet-to-json/node_modules/google-spreadsheet/node_modules/xml2js/node_modules/sax/lib/sax.js:644:5)
    at closeTag (/usr/local/lib/node_modules/google-spreadsheet-to-json/node_modules/google-spreadsheet/node_modules/xml2js/node_modules/sax/lib/sax.js:903:7)
bassarisse commented 8 years ago

Hi, sorry for the (big) delay.

I commited a fix for this (version 0.1.6). However, the format of the spreadsheet you're using isn't correctly supported by this package. You can get better results by using the vertical option (-i), but I don't think it would be satisfactory.