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

306
Vistas
GET Fetch working but POST Fetch not working - Google APIs in Chrome Extension

I am still not understanding how fetch requests are structured. In my Chrome Extension, I have used an API key from my console to GET some values from a spreadsheet:

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

It worked, but when I want to append some values, it doesn't:

let fetch_url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/Teachers!A7:D8:append?key=${API_KEY}`;
    
let fetch_options = {
                       "method": "POST",
                       "body": JSON.stringify({
                                 "values": [
                                              ["Door", "$15", "2", "3/15/2016"],
                                              ["Engine", "$100", "1", "3/20/2016"],
                                           ]
                                  })
                    };

I get a 401 response, what am I missing?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you check the doucmentation sheet values

You will notice that it states

enter image description here

This is because this method is preformed on a private user data. This means that you need an authorization header with a valid oauth2 access token with one of those scopes in order to access that method.

Authorize the request and then you will be able to access the data. There is a javascript guild which might help you understand how to preform the authorization of your application.

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