Tag: google sheets

以编程方式编辑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 […]

如何使用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( […]

从谷歌文档电子表格中读取数据

在我的应用程序中,我必须显示谷歌文档电子表格的详细信息。 在这张电子表格中,我有两张纸。 我需要在2个不同的活动中展示每张表格。 任何人都可以帮我实现这个function。 这一切需要什么? 我找到了一个名为jxl.jar的jar。 我应该用吗?

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; /** * * […]

使用Google Sheet API V4将数据写入Google表格 – Java示例代码

我有一个开发的测试自动化框架,可以在excel表中为测试用例写入通过或失败值。 我们已决定迁移到Google表格。 任何人都可以提供一个示例Java代码,使用Google Sheet API V4将数据写入Google表格吗? 我有一个表格文件,但目前尚不清楚。 谢谢。

如何使用Java客户端访问Google服务?

我正在开发一个在Google Apps Engine(GAE)上注册的名为“searcegadget2”的Java应用程序。 我已经使用OAuthHmacSha1Signer()实现了3脚OAuth 。 我正确地获得了访问令牌并将其存储在会话中 (会话已启用 )。 接下来,我使用链接onclick事件调用servlet。 此servlet用于使用accesstoken访问Spreadsheet服务。 我的代码是: GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters(); oauthParameters.setOAuthConsumerKey(CONSUMER_KEY); oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET); oauthParameters.setOAuthType(OAuthParameters.OAuthType.THREE_LEGGED_OAUTH); oauthParameters.setScope(“https://spreadsheets.google.com/feeds/”); oauthParameters.setOAuthToken(request.getSession().getAttribute(“oauth_token”).toString()); oauthParameters.setOAuthVerifier(request.getSession().getAttribute(“oauth_verifier”).toString()); oauthParameters.setOAuthTokenSecret(request.getSession().getAttribute(“oauth_token_secret”).toString()); out.println(“Accessing Service”); GoogleService googleService = new GoogleService(“wise”, “searceapps-searcegadget2-1”); out.println(“Setting Parameter”); googleService.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer()); out.println(“Setting URl”); URL feedUrl = new URL(“https://spreadsheets.google.com/feeds/spreadsheets/private/full”); out.println(“Accessing ResultFeed”); SpreadsheetFeed resultFeed = googleService.getFeed(feedUrl, SpreadsheetFeed.class); out.println(“”); out.println(“Response Data:”); out.println(“=====================================================”); out.println(“| […]

谷歌电子表格API,400错误错误请求:无法解析范围

我正在尝试使用电子表格示例访问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 […]

使用Google Spreadsheet API在Google中的Google驱动器中创建电子表格

我创建了一些填充谷歌电子表格的工具。 它工作正常1年,因为今天我错了 Exception in thread “main” com.google.gdata.util.AuthenticationException: Error authenticating (check service name) at com.google.gdata.client.GoogleAuthTokenFactory.getAuthException(GoogleAuthTokenFactory.java:688) at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:560) at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:397) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:364) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:319) at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:303) 这是与gmail连接的代码部分: String USERNAME = “usename@……..com”; ->of course I’m using proper username and password String PASSWORD = “*******”; SpreadsheetService service = new SpreadsheetService(“SandboxCheck”); service.setUserCredentials(USERNAME, PASSWORD); 我不知道如何连接gmail,我试图通过oAuth这样做,但我不知道如何做到这一点。 在https://developers.google.com/google-apps/spreadsheets/authorize上的示例中,只有.net的代码。