현재 Google 스프레드 시트에서 Google 스프레드 시트 v4 API를 사용하여 행을 삭제하려고합니다.(Android/Java) Google 스프레드 시트 v4 isUserRecoverableError 상태 : NEED_PERMISSION
private void deleteRow()
{
List<Request> requests = new ArrayList<>();
DeleteDimensionRequest deleteDimensionRequest = new DeleteDimensionRequest();
DimensionRange dimensionRange = new DimensionRange();
dimensionRange.setStartIndex(14);
dimensionRange.setEndIndex(15);
deleteDimensionRequest.setRange(dimensionRange);
requests.add(new Request()
.setDeleteDimension(deleteDimensionRequest)
);
BatchUpdateSpreadsheetRequest batchUpdateRequest = new BatchUpdateSpreadsheetRequest()
.setRequests(requests);
try
{
mService.spreadsheets().batchUpdate("Spreadsheet_ID", batchUpdateRequest).execute();
}
catch(IOException e)
{
e.printStackTrace();
}
}
오류이 기능이 나를되어 있습니다 : 여기
내가 사용하고있는 코드입니다 내 다른 클래스 파일에서08-14 15:47:10.818 26956-27285/com.xxx.xxxxx.xxxxxxxx
W/GoogleAuthUtil: isUserRecoverableError status: NEED_PERMISSION
, 나는 이미 포함 권한의 범위를 표시 한 드라이브 및 스프레드 시트. 여기
오류의 사진이다public static Credential authorize() throws IOException {
// Load client secrets.
InputStream in =
SheetsQuickstart.class.getResourceAsStream("/client_secret.json");
GoogleClientSecrets clientSecrets =
GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
// Build flow and trigger user authorization request.
GoogleAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow.Builder(
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
.setDataStoreFactory(DATA_STORE_FACTORY)
.setAccessType("offline")
.build();
Credential credential = new AuthorizationCodeInstalledApp(
flow, new LocalServerReceiver()).authorize("user");
System.out.println(
"Credentials saved to " + DATA_STORE_DIR.getAbsolutePath());
return credential;
}
이 안드로이드 빠른 의해 제공된 하나 이외에 선서 증명서의 일종 ... 자바 빠른에서
그 포함시켜야합니까? 를 얻을 수
전략 : 안드로이드 응용 프로그램과 시트를 관리하는 관련없는 하나의 문제가 있으므로
범위 외에 유효한 oauth 자격 증명을 포함하고 있습니까? (또한 by, 시작 범위가 포함되며 끝 범위는 배타적입니다. 따라서 [14,14]을 삭제하라는 요청은 아무 것도 삭제하지 않게됩니다. 14 번 행을 삭제하려면 [14,15]을 입력하십시오.) –
답장을 보내 주셔서 감사합니다. 나머지 코드는 간단히 샘플 빠른 시작입니다 ... mCredential = GoogleAccountCredential.usingOAuth2 ( getApplicationContext(), Arrays.asList (SCOPES)) .setBackOff (새로운 ExponentialBackOff()); 다른 유효한 맹세 증명서를 포함시키는 방법에 대해 잘 모르겠습니다 ... API 키가 필요합니까? – LinearM