gpt4 book ai didi

java - Google 电子表格 API,400 错误错误请求 : unable to parse range

转载 作者:IT老高 更新时间:2023-10-28 20:50:36 26 4
gpt4 key购买 nike

我正在尝试使用电子表格示例访问 Google 电子表格。当我运行示例代码时,它运行良好。我只是更改 SpreadsheetId 和范围。它开始给我:

Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Unable to parse range: Class Data!A2:A4",
"reason" : "badRequest"
} ],
"message" : "Unable to parse range: Class Data!A2:A4",
"status" : "INVALID_ARGUMENT"
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at poc.mainPOC.main(mainPOC.java:157)

下面是代码:

  String spreadsheetId = "my spread sheet ID";
String range = "Class Data!A2:A4";
ValueRange response = service.spreadsheets().values()
.get(spreadsheetId, range)
.execute();

最佳答案

尝试将 Class Data!A2:A4 替换为 A2:A4

关于java - Google 电子表格 API,400 错误错误请求 : unable to parse range,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37893515/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com