Google-api-nodejs-client: sheets.spreadsheets.values.append 24.0.0 OK // 25.0.0.0 KO [valueInputOption]

Created on 25 Jan 2018  路  13Comments  路  Source: googleapis/google-api-nodejs-client

sheets.spreadsheets.values.append({
    auth: auth,
    spreadsheetId: 'spreadshiiitID',
    range: 'id_clients!A1:B2',
    valueInputOption: "USER_ENTERED",
    resource: {
      values: [
        ["Void", "Canvas", "Website"],
        ["Paul", "Shan", "Human"]
      ]
    }
  }, function(err, response) {
    if (err) {
      console.log('The API returned an error: ' + err);
      return;
    }

    console.log(JSON.stringify(response, null, 2));
  });

Error: 'valueInputOption' is required but not specified

this code works if
npm install [email protected]
but not with npm install [email protected]

What is the new code snippet for "valueInputOption" ? Maybe there is a regression.

Thanks!

needs more info

Most helpful comment

We shipped a pretty big update in 25, so it's entirely likely something regressed. I can take a look at this today.

All 13 comments

We shipped a pretty big update in 25, so it's entirely likely something regressed. I can take a look at this today.

Can confirm "valueInputOption" is not being parsed as param.

Reconfirm.

that works thanks

@KamilHawk123 did you find out how to fix this?
If yes, what was the solution?

Hello. Unfortunately, valueInputOption is still not being parsed on 26.0.1. (i'm updating a spreadsheet instead of appending values)

Greetings folks! I am struggling to reproduce this one. I went ahead and added a sample and a test over here, just to make sure I'm not crazy:
https://github.com/google/google-api-nodejs-client/pull/1067

Is there anything in that sample that I'm missing?

Sometimes things like this will pop up if you have an old version of google-auth-library installed. Can you check your package.json, and verify you DO NOT have google-auth-library added there?

Dear All,
the issue Error: 'valueInputOption' is required but not specified is still exist in version ^27.0.0.

While executing the below code im still getting the error.

sheets.spreadsheets.values.update({
    auth: auth,
    spreadsheetId: '<id>',
    range: 'Sheet1!A1',
    valueInputOption: 'USER_ENTERED',
    insertDataOption: 'INSERT_ROWS',
}, function(err, response) {
    console.log('err', err);
    console.log(response);
    res.send('done!');
});

Any suggestion or workaround for the above issue would be highly appreciated.

Can you share a full code samples? How are you getting your 'auth' object?

var googleAuth = require('google-auth-library')
, googleAuth= new googleAuth()
, clientId = googleAppSheet.clientId
, clientSecret = googleAppSheet.clientSecret
, redirectUrl = config.get('baseurl') + '/google/sheet/create' 
, auth = new googleAuth.OAuth2(clientId, clientSecret, redirectUrl);

generateToken: function(callback) {
    auth .credentials = {
        access_token: googleAppSheet.accessToken,
        refresh_token: googleAppSheet.refreshToken
    };
    return callback(auth);
}

Yup, as I mentioned above, you need to delete google-auth-library from your package.json. Delete var googleAuth = require('google-auth-library'); from your code. Follow the example here:
https://github.com/google/google-api-nodejs-client#generating-an-authentication-url

Good luck!

Migrating to version 24.0.0 works.

Still working on it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oliverjessner picture oliverjessner  路  3Comments

skiod picture skiod  路  3Comments

ovaris picture ovaris  路  3Comments

raapperez picture raapperez  路  3Comments

nanu-c picture nanu-c  路  3Comments