Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: cb is not a function #105

Closed
chrisalcantara opened this issue Apr 23, 2016 · 6 comments
Closed

TypeError: cb is not a function #105

chrisalcantara opened this issue Apr 23, 2016 · 6 comments

Comments

@chrisalcantara
Copy link

Keep getting this error every time I try to update a cell value or use any functions (del, bulkUpdate, etc) for that matter.

doc.getInfo(function(err, info) {

    sheet = info.worksheets[10];

    sheet.getCells({
        'min-row': 2,
        'max-row': 5,
        'return-empty': false
    }, function(err, cells) {
        var cell = cells[0];
        cell.value = 'test';
        cell.save();
    });
});
@theoephraim
Copy link
Owner

cell.save is expecting a callback!
usually wise even if you just log it so you can see if there are any errors happening

@tablekat
Copy link
Contributor

While I personally feel like cell.save shouldn't fail if not given a callback, if that is the case then the README may need to be updated because it shows cell.save(); without one.

tablekat added a commit to tablekat/node-google-spreadsheet that referenced this issue May 12, 2016
@awb99
Copy link

awb99 commented May 28, 2016

@theoephraim the demos show save without a calllback. You should upate the demos!

@peter-mouland
Copy link

peter-mouland commented Aug 8, 2016

interesting PR, but i think because it is async, allowing callbacks to be omitted would be more mis-leading to the user. It would give the impressions that those calls are sync.

Although, the lack of callbacks in the readme example tripped me over, it was mentioned that the callbacks had been missed for berevity. However, i think including , cb on those functions would be a better way to give the examples.

Happy to do a PR if you're happy to accept?

@tablekat
Copy link
Contributor

tablekat commented Aug 8, 2016

I think it's still unintuitive considering most other asynchronous libraries do not require a callback for things like .save() where you don't always need to get a result. Some notable ones are mongoose (.save() doesn't require a callback), requestjs, and even in standard es6 promises you can call .then() and not pass anything to it.

theoephraim added a commit that referenced this issue May 27, 2017
Made cell.save consistent with row.save in terms of requiring a callback (#105)
@theoephraim
Copy link
Owner

FYI - I've just a published a new version of this module which is a complete rewrite using Google's V4 Sheets API (v3 is being deprecated on March 3, 2020). YOU MUST MIGRATE IF YOU ARE STILL USING THIS PACKAGE!

Docs available here - https://theoephraim.github.io/node-google-spreadsheet

The new version is promise based and should be much cleaner.

Thanks! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants