问题
If I try to get data from Google Sheets with a basic spreadsheets.values.get request like this
https://sheets.googleapis.com/v4/spreadsheets/1p7sFt.....gRu9A/values/Sheet!1A1:L7?key=AIza.....oTXg it works.
But, if I add more parameters to the request it fails. Ex:
https://sheets.googleapis.com/v4/spreadsheets/1p7sFt.....gRu9A/values/Sheet1!A1:L7**?majorDimension=COLUMNS**?key=AIza.....oTXg
and returns:
{
"error": {
"code": 403,
"message": "The request cannot be identified with a client project. Please pass a valid API key with the request.",
"status": "PERMISSION_DENIED"
}
}
回答1:
Use ampersand &
for multiple query string parameters, not multiple ?
https://sheets.googleapis.com/v4/spreadsheets/1p7sFt.....gRu9A/values/Sheet1A1:L7**?majorDimension=COLUMNS**&key=AIza.....oTXg
来源:https://stackoverflow.com/questions/39723512/getting-permission-denied-when-try-to-access-google-sheets-with-api-key