So I have been doing several hours of searching on this and cannot find anything that works with the current Google Sheets API (v4) in a browser. I can 100% get data through Postman and even a browser address bar. I have a public Google Spreadsheet. I have an API Key. I can successfully return all of the row data.
As soon as I try to do so in a browser extension, I get nothing.
Is anyone aware of how to configure a JavaScript fetch() call to get a successful return on a public Google Spreadsheet? No editing, no deleting. Just a GET.
Here's what I'm trying but isn't working:
var url = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${sheetId}?key=${key}` var response = await fetch(url, { method: "GET", mode: "no-cors", headers: { "Host": "sheets.googleapis.com" } }); Two things I noticed:
- If
modewasn't set tono-corsin thefetch()I would get a NetworkError - In Postman if there wasn't a
Hostheader, I would get an error response
没有评论:
发表评论