Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

460
Views
How to read a single google sheets cell value in javascript

I am trying to pull just one cell value from a google sheet using javascript and the google sheets API, and I am using the below code, but I keep getting the below error which I can't understand because I am using the spreadsheet id and range.

throw new Error('Missing required parameters: ' + missingParams.join(', ')); Error: Missing required parameters: spreadsheetId, range

const auth = new google.auth.GoogleAuth({
            keyFile: "sheets-credentials.json",
            scopes: "https://www.googleapis.com/auth/spreadsheets",
        });
const client = await auth.getClient();
const googleSheets = google.sheets({ version: "v4", auth: client });
const spreadsheetId = "asheetid";
googleSheets.spreadsheets.values.get(spreadsheetId, `Sheet1!D1`)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In your script, please modify as follows.

From:

googleSheets.spreadsheets.values.get(spreadsheetId, `Sheet1!D1`)

To:

googleSheets.spreadsheets.values.get({spreadsheetId, range: `Sheet1!D1`});

Reference:

  • Method: spreadsheets.values.get

Added:

From your following replying,

Now there's no error but it just returns "[object Promise]"

From this situation, I could confirm that your script worked. If you want to retrieve the values from googleSheets.spreadsheets.values.get({spreadsheetId, range: Sheet1!D1});, how about the following sample script?

Sample script1:

const res = await googleSheets.spreadsheets.values.get({spreadsheetId, range: `Sheet1!D1`});
console.log(res.data);

Sample script2:

googleSheets.spreadsheets.values.get(
  {
    spreadsheetId,
    range: `Sheet1!D1`,
  },
  (err, res) => {
    if (err) {
      console.log(err);
      return;
    }
    console.log(res.data);
  }
);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!