sheet-db icon indicating copy to clipboard operation
sheet-db copied to clipboard

Sheet connect() not work as expected

Open huan opened this issue 5 years ago • 1 comments

My google spreadsheet is public read & write able.

My code t.js is as the following:

const connect = require('sheet-db')

// https://docs.google.com/spreadsheets/d/106lfsqgEOMqRX3apK3qGbVcjQIaCK7EudHHI3-TpEKQ/edit?usp=sharing
const sheet = connect('106lfsqgEOMqRX3apK3qGbVcjQIaCK7EudHHI3-TpEKQ')

sheet
  .info().then(console.info)
  .catch(console.error)

It show the following error message when I run it:

$ node t.js
Error: The response contains invalid data
    at _callee$ (/home/huan/git/mike-bo/node_modules/sheet-db/lib/rest_client.js:44:31)
    at tryCatch (/home/huan/git/mike-bo/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/home/huan/git/mike-bo/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/home/huan/git/mike-bo/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/home/huan/git/mike-bo/node_modules/sheet-db/lib/rest_client.js:588:191)
    at /home/huan/git/mike-bo/node_modules/sheet-db/lib/rest_client.js:588:361
    at process._tickCallback (internal/process/next_tick.js:68:7)

huan avatar Dec 30 '19 07:12 huan

Valid point, I need to update the Readme. Thing is you still need an access token even you are trying to read a public spreadsheet, so there is no "tokenless" scenario. I'll update a readme and add a check to throw more meaningful error.

tadam313 avatar Feb 08 '20 21:02 tadam313