请求 google 工作表有问题,Highcharts 错误 404
Problem with request google sheets with Highcharts error 404
我在从 google sheet 请求时一直遇到 Highcharts 问题,几天前一切正常,但突然抛出错误 404,我没有知道要做什么。 Higcharts 仅要求您输入 google spreadsheet 键和选项卡的编号,仅此而已。我想更改 Higcharts 发出请求的 URL,但我不知道如何更改。
错误:
data.src.js:124 GET https://spreadsheets.google.com/feeds/cells/1YtSfF3-9kzx1G6zwllLX9GhkVgufSUjQyKVI3Ken-AA/2/public/values?alt=json 404
尝试使用此函数获取值 json
function getJson(id,gid){
var txt = UrlFetchApp.fetch(`https://docs.google.com/spreadsheets/d/${id}/gviz/tq?tqx=out:json&tq&gid=${gid}`).getContentText();
var jsonString = txt.match(/(?<="table":).*(?=}\);)/g)[0]
var json = JSON.parse(jsonString)
return(json)
}
- 带有传播的 idsheet 和你的 sheet 的 gid(可能是 0)
- 请注意,第一行专用于标签,然后行[0] 对应行#2,c[0] 对应列A
- 如果要检索 B1(第 2 列第 1 行):
json.cols[1].label
- 如果要检索 B2(第 2 列第 2 行):
json.rows[0].c[1].v
这似乎是一个 google 问题:https://support.google.com/docs/thread/121088347/retrieving-data-from-sheets-results-in-404-error-50-of-the-time
feeds 是表格的旧版本 API,它已关闭。
请在此处查看 Google 的公告 https://cloud.google.com/blog/products/g-suite/migrate-your-apps-use-latest-sheets-api
我在从 google sheet 请求时一直遇到 Highcharts 问题,几天前一切正常,但突然抛出错误 404,我没有知道要做什么。 Higcharts 仅要求您输入 google spreadsheet 键和选项卡的编号,仅此而已。我想更改 Higcharts 发出请求的 URL,但我不知道如何更改。 错误:
data.src.js:124 GET https://spreadsheets.google.com/feeds/cells/1YtSfF3-9kzx1G6zwllLX9GhkVgufSUjQyKVI3Ken-AA/2/public/values?alt=json 404
尝试使用此函数获取值 json
function getJson(id,gid){
var txt = UrlFetchApp.fetch(`https://docs.google.com/spreadsheets/d/${id}/gviz/tq?tqx=out:json&tq&gid=${gid}`).getContentText();
var jsonString = txt.match(/(?<="table":).*(?=}\);)/g)[0]
var json = JSON.parse(jsonString)
return(json)
}
- 带有传播的 idsheet 和你的 sheet 的 gid(可能是 0)
- 请注意,第一行专用于标签,然后行[0] 对应行#2,c[0] 对应列A
- 如果要检索 B1(第 2 列第 1 行):
json.cols[1].label
- 如果要检索 B2(第 2 列第 2 行):
json.rows[0].c[1].v
这似乎是一个 google 问题:https://support.google.com/docs/thread/121088347/retrieving-data-from-sheets-results-in-404-error-50-of-the-time
feeds 是表格的旧版本 API,它已关闭。 请在此处查看 Google 的公告 https://cloud.google.com/blog/products/g-suite/migrate-your-apps-use-latest-sheets-api