Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
How to get a specific row by specific value from a google sheet via Express JS

I am working on a little project where I want to get a specific row from a specific Google sheet, by a specific value (last_name).

This is a Google sheet where I have a list of users.

I am using Express JS and the package googleapis for Node js.

Actually, this is the output I have with my API call.

[
    [
        "LASTNAME1",
        "FIRSTNAME1",
        "0100000000",
        "email@email1.com"
    ],
    [
        "LASTNAME2",
        "FIRSTNAME2",
        "0100000000",
        "email@email2.com"
    ],[
        "LASTNAME3",
        "FIRSTNAME3",
        "0100000000",
        "email@email3.com"
    ]
]

Actually I managed to sort the data like this but I don't know what to do next, can you help me?

[
  'LASTNAME1, email@email1.com',
  'LASTNAME2, email@email2.com',
  'LASTNAME3, email@email3.com'
]

This is my method :

const auth = new google.auth.GoogleAuth({
            keyFile: "keys.json",
            scopes: "https://www.googleapis.com/auth/spreadsheets",
        });
        const authClientObject = await auth.getClient();
        const googleSheetsInstance = google.sheets({ version: "v4", auth: authClientObject });
        const spreadsheetId = "idofmygooglesheet";
        const readData = await googleSheetsInstance.spreadsheets.values.get({
            auth,
            spreadsheetId,
            range: "B10:M",
        })
        const rows = readData.data.values!;
        let users: any[] = [];
        if (rows.length) {
            rows.map((row) => {
                users.push(`${row[0]}, ${row[3]}`);
            });
        } else {
            console.log('No user found with this name.');
        }
        console.log(users);
        res.status(httpStatus.OK).json(readData.data.values);

Thank you very much for your help !

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda