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

304
Views
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 answers
Answer question

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 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!