Tag: google spreadsheet api

如何导入适用于Java和Google表格API版本3.0的Drive API客户端库

经过数周的文档和大量论坛的努力,我发现了如何使用Drive API Client Library for Java和Google Sheets API。 我觉得特别是针对android的文档非常缺乏,所以我认为发一篇文章解释如何导入Android的API会很有用。 这是我希望在我开始使用这两个库时可以找到的post,我希望这可以帮助那些可能遇到我的问题的人。

以编程方式编辑Google电子表格

我有一个用户输入的程序,但现在我希望每次用户提交表单时都可以通过编辑Google电子表格来保存输入。 基本上,Google电子表格会不断更新。 任何人都可以提供一个关于我如何能够实现这一目标的教程吗? 我使用Eclipse编写Java,我需要哪些插件? 我已经尝试使用Google Spreadsheets API中提供的一些示例代码( 添加列表行部分),但我似乎无法让它工作。 import com.google.gdata.client.spreadsheet.*; import com.google.gdata.data.spreadsheet.*; import com.google.gdata.util.*; import java.io.IOException; import java.net.*; import java.util.*; public class MySpreadsheetIntegration { public static void main(String[] args) throws AuthenticationException, MalformedURLException, IOException, ServiceException { SpreadsheetService service = new SpreadsheetService(“MySpreadsheetIntegration-v1”); // TODO: Authorize the service object for a specific user (see other sections) // Define […]

使用SpreadSheet API时无法完成HTTP请求

我正在开发一个Google App Engine应用程序,它可以读取和编辑一个包含大约150列和500行的大型SpreadSheet。 除了特定的大小(它可能会有所不同),我正在寻找一种提高性能的方法,因为大多数时候我得到500内部服务器错误(如下所示)。 java.lang.RuntimeException:无法完成HTTP请求由以下原因引起:java.net.SocketTimeoutException:获取URL时超时: https : //spreadsheets.google.com/feeds/worksheets/xxxxxxxxxxxxxxxxxxxxxxx/private/full 在下面的代码片段中,您可以看到我如何阅读我的SpreadSheet以及哪一行抛出exception。 for (SpreadsheetEntry entry : spreadsheets) { if (entry.getTitle().getPlainText().compareTo(spreadsheetname) == 0) { spreadsheet = entry; } } WorksheetFeed worksheetFeed = service.getFeed(spreadsheet.getWorksheetFeedUrl(), WorksheetFeed.class); List worksheets = worksheetFeed.getEntries(); WorksheetEntry worksheet = worksheets.get(0); URL listFeedUrl = worksheet.getListFeedUrl(); // The following line is the one who generates the error ListFeed listFeed […]

如何使用Android Google Spreadsheet API创建列表范围validation

我正在创建一个Android应用程序,在Google云端硬盘中创建一个新的电子表格并在其中插入一些数据。 目前我可以插入免费的文本和公式,但我需要添加一些特定的validation,特别是一个带有预定义值的下拉列表。 预期的结果应该是这样的: 我正在使用此代码: SpreadsheetFeed feed = spreadsheetService.getFeed( FeedURLFactory.getDefault() .getSpreadsheetsFeedUrl(), SpreadsheetFeed.class); // Creating the list of spreasheets in GDrive List spreadsheets = feed.getEntries(); // parsing trough the feed entries for (int i = 0; i < spreadsheets.size(); i++) { com.google.gdata.data.spreadsheet.SpreadsheetEntry e = (com.google.gdata.data.spreadsheet.SpreadsheetEntry) spreadsheets.get(i); // IF WE LOCATE THE FILE BASED ON THE FILENAME if( […]

Java到Google电子表格

我试图使用Java进行编程以连接到Google Spreadsheet来进行数据检索或修改单元格中的数据。 我的Google电子表格链接是https://docs.google.com/spreadsheets/d/1UXoGD2gowxZ2TY3gooI9y7rwWTPBOA0dnkeNYwUqQRA 我查看了Sheets API ,它需要链接 https://spreadsheets.google.com/feeds/worksheets/key/private/full 我尝试过不同forms的链接,例如: https://spreadsheets.google.com/feeds/worksheets/1UXoGD2gowxZ2TY3gooI9y7rwWTPBOA0dnkeNYwUqQRA/private/full https://spreadsheets.google.com/feeds/worksheets/1UXoGD2gowxZ2TY3gooI9y7rwWTPBOA0dnkeNYwUqQRA/private/full 他们分别给了我不同的错误: com.google.gdata.util.ParseException: Unrecognized content type:application/binary com.google.gdata.util.RedirectRequiredException: Moved Temporarily 我不知道如何使用Java连接到Googl电子表格。 如果您有这方面的经验,请帮助我。 import com.google.gdata.client.authn.oauth.*; import com.google.gdata.client.spreadsheet.*; import com.google.gdata.data.*; import com.google.gdata.data.batch.*; import com.google.gdata.data.spreadsheet.*; import com.google.gdata.util.*; import org.testng.annotations.Test; import java.io.IOException; import java.net.*; import java.util.*; public class TestGoogleSheetsAPI { @Test public void testConnectToSpreadSheet() throws ServiceException, IOException { SpreadsheetService service = […]

使用Google Drive + Java中的Google Spreadsheet API创建电子表格

我已经通过Google官方文档开发者指南Spreadsheet API中提到的简单Java代码在My Google Drive帐户的现有电子表格中成功创建了一个新工作表,但我想通过java代码在我的Google云端硬盘帐户中创建一个新的电子表格 。 在上面提到的链接中,他们没有提到任何示例代码。 我经历了很多链接,但没有得到怎么做? 我已经在Spreadservice类中看到了不同的方法。 我没有了解如何使用Google Spreadsheet API? /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import com.google.gdata.client.spreadsheet.*; import com.google.gdata.data.Link; import com.google.gdata.data.PlainTextConstruct; import com.google.gdata.data.TextConstruct; import com.google.gdata.data.docs.ExportFormat; import com.google.gdata.data.spreadsheet.*; import com.google.gdata.util.*; import java.io.IOException; import java.net.*; import java.util.*; import javax.xml.soap.Text; /** * * […]

Java | 如何使用API​​在Google电子表格范围内查找值(行号和列号)?

我正在使用Java API(V4)从谷歌工作表中读取和编辑数据。 到目前为止,我能够根据行号和列号(索引)读取和编辑数据。 我想要做的是按照其特定值本地化数据(我想使用其值获取特定单元格的行和列号)。 到目前为止,这是我用来编辑数据的工作代码的一部分: // Copy the format from A1:C1 and paste it into A2:C5, so the data in // each column has the same background. requests.add(new Request() .setCopyPaste(new CopyPasteRequest() .setSource(new GridRange() .setSheetId(0) .setStartRowIndex(0) .setEndRowIndex(1) .setStartColumnIndex(0) .setEndColumnIndex(3)) .setDestination(new GridRange() .setSheetId(0) .setStartRowIndex(1) .setEndRowIndex(6) .setStartColumnIndex(0) .setEndColumnIndex(3)) .setPasteType(“PASTE_FORMAT”))); BatchUpdateSpreadsheetRequest batchUpdateRequest = new BatchUpdateSpreadsheetRequest() .setRequests(requests); 谁能帮帮我吗? 先感谢您。

使用OAuth 2.0进行Java和Google Spreadsheets API授权

我想使用Java阅读Google Spreadsheets,推荐的方法是使用Google Spreadsheets API 。 当您想要使程序安全时,问题就开始了,因此他们鼓励您使用OAuth 2.0。 在官方页面中,他们展示了如何仅使用.NET执行此操作并说“ Java客户端库当前不支持OAuth 2.0 ”,并且他们提供了使用OAuth 1.0或使用直接电子邮件和密码进行 Client Login等替代方案。 这是肯定的吗?,没有办法通过Java进行OAuth 2.0身份validation,可能不是直接使用Java客户端库,而是通过具有特定参数的请求。 请相信任何建议。

如何通过Google电子表格API(gdata)仅从Google电子表格中获取重新计算的单元格

Gdata提供了一种基于时间戳从谷歌电子表格中获取仅更改单元格的方法。 我该如何为Gdata调用创建时间戳? 即“只返回发布时间等于或晚于指定时间戳的条目。” setPublishedMax() https://developers.google.com/gdata/javadoc/com/google/gdata/client/Query#setPublishedMax (com.google.gdata.data.DateTime ) 有没有办法从服务器中提取当前时间? 如果我创建本地时间戳,我该如何同步它,什么时区?

将OAuth 2.0和Google Spreadsheet API与Jav​​a结合使用的示例是什么?

示例代码在哪里显示如何使用Google Data Java Client Library及其对OAuth 2.0支持与Google Spreadsheet API (现在称为Google Sheets API )?