我正在使用 Google Drive SDK 使用以下代码创建电子表格:
File body = new File();
body.setTitle(title);
body.setMimeType("application/vnd.google-apps.spreadsheet");
body.setParents(Arrays.asList(new ParentReference().setId(currentParent)));
File file = driveHelper.getDrive().files().insert(body).execute();
有没有办法使用 Google 电子表格 API 获取通过 Drive SDK 创建的特定电子表格? 我在不同的文件夹中有许多同名的电子表格,当我循环遍历所有电子表格时 我不想通过比较标题来获取特定的电子表格。
最佳答案
Google 电子表格 API 使用电子表格 key 。当您在浏览器中打开电子表格时,此 KEY 将显示在 URL 中。要查看它的使用情况,有一个简单的谷歌演示 CellDemo.java。 http://gdata-java-client.googlecode.com/svn-history/r51/trunk/java/sample/spreadsheet/cell/CellDemo.java
我认为可以从驱动器 api 获取所有 key ,因为你可以这样做:
Drive driveService = new Drive.Builder(TRANSPORT, JSON_FACTORY, credential).build();
File file = driveService.files().get(this.spreadsheetKey).execute();
关于java - 获取使用 Drive SDK 创建的电子表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21144002/