Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

462
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda