我想从 google sheet api 获取数据,但它响应:
{
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}
}
其他通过 google sheet api 创建并保存在驱动器中的文件是可读的,但是当我在驱动器中手动创建文件并尝试读取数据时,它会失败。
我使用的代码是这样的:
readfromURL = async (connectionObj, sheetId) => {
const { accessToken } = connectionObj;
const response = await axios(`https://sheets.googleapis.com/v4/spreadsheets/${sheetId}/values/Sheet1!A1:D5`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `Bearer ${accessToken}`,
},
});
}
}
如果需要更多信息,请告诉。