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

231
Visualizações
The request is missing a valid API key - Google Sheets

This is the background.js script of my Chrome Extension. I am trying to get a value from a spreadsheet using Sheets APIs. The sheet can be read by anyone, so I thought I wouldn't need any OAuth2 permissions/scopes and sign-in.

     if (message.action == 'clicked') {
            if (!connected){
                var user = message.user;
                var range = 'Teachers!A:A';
                let fetch_url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${range}`;
                fetch(fetch_url)
                    .then(res => res.json())
                    .then(res => {
                        console.log(res);
                    })
                };
            }

When I try to fetch, I receive this error:

error: {code: 403, message: 'The request is missing a valid API key.', status: 'PERMISSION_DENIED'}

What is wrong with my logic? Can't I avoid having to sign in people?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I needed to go to the Google Cloud Console and create an API key (and it is better to restrict it to the Sheets API for security).

I took that key and saved it as a variable and included it in the fetch URL like this:

let fetch_url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${range}?key=${API_KEY}`;

Worked!

about 4 years ago · Juan Pablo Isaza Relatório

0

it's not reading ${spreadsheetId} key, make sure it's linked correctly cause that error happen when you don't provide a correct api key

about 4 years ago · Juan Pablo Isaza Relatório
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