2014-01-15 40 views
1

我使用的是谷歌硬碟SDK与此代码创建电子表格创建的电子表格:获取与硬碟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(); 

有没有办法让使用谷歌电子表格API驱动器SDK创建一个特定的电子表格? 我有很多电子表格在不同的文件夹中有相同的名称,当我遍历所有 电子表格时,我不想比较标题以获得特定的电子表格。

回答

0

谷歌电子表格API使用电子表格键。当您在浏览器中打开电子表格时,该键显示在URL中。看到它被使用,有一个简单的谷歌演示CellDemo.java。 http://gdata-java-client.googlecode.com/svn-history/r51/trunk/java/sample/spreadsheet/cell/CellDemo.java

我想这是可以从驱动器的API获得所有钥匙,因为你可以这样做:

Drive driveService = new Drive.Builder(TRANSPORT, JSON_FACTORY, credential).build(); 
File file = driveService.files().get(this.spreadsheetKey).execute();