我正在尝试更新Google表格值.
"请求具有无效的身份验证凭据.预期的OAuth 2访问令牌,登录cookie或其他有效的身份验证凭据."
我想使用API密钥而不是outh 2.0来做到这一点
任何人都可以有任何建议.
我成功创建了一个Spring Boot Serviceclass,以便在Goets工作表上编写,遵循Sheets API的Java Quistart教程
我的问题是授权没有续订,所以在第一次成功通过浏览器进行身份验证后,几个小时后我就会获得401未授权.如何在不重新发布浏览器登录的情况下自动续订令牌?
在代码下面,提前感谢
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver.Builder;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.sheets.v4.Sheets;
import com.google.api.services.sheets.v4.SheetsScopes;
import com.google.api.services.sheets.v4.model.AppendValuesResponse;
import com.google.api.services.sheets.v4.model.ValueRange;
@Service
public class GoogleSheetsServiceImpl implements GoogleSheetsService {
private static final Log LOGGER = LogFactory.getLog(GoogleSheetsServiceImpl.class);
/** Application name. */
@Value("${google-sheets.application-name}")
private String applicationName;
/** Directory to store user credentials for this application. */
private static final java.io.File DATA_STORE_DIR = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用需要使用Google电子表格API的Android应用.我是新手,所以我从api的第3版开始:https://developers.google.com/google-apps/spreadsheets/
我按照所有步骤,将所有jar文件下载到lib我的项目文件夹中的子文件夹,然后像往常一样添加到Eclipse中的构建路径.因此虽然没有Java示例来执行Oauth 2.0,但我只是试图声明:
SpreadsheetService service = new SpreadsheetService("v1");
Run Code Online (Sandbox Code Playgroud)
但是当我模仿这个简单的行时,它给了我一个错误:
java.lang.NoClassDefFoundError: com.google.gdata.client.spreadsheet.SpreadsheetService
Run Code Online (Sandbox Code Playgroud)
我正在使用文档中包含的所有jar,我有导入:
import com.google.gdata.client.spreadsheet.SpreadsheetService;
Run Code Online (Sandbox Code Playgroud)
但我完全迷失了.我不知道还有什么可以开始,连接到Google API并使用电子表格.
android google-api google-sheets google-docs-api google-sheets-api
我想在另一个电子表格中从超链接打开一张特定的Google电子表格.
我的主电子表格中有不同的链接,每个都应该有一个指向同一个从属电子表格但不同表格的超链接.
我知道超链接功能,但它不适用于特定的工作表.
谢谢您的帮助
是否可以在指定的文件夹中创建电子表格,或者我是否必须使用Drive API随后移动它?
新的Google表格API v4目前每天都有无限的读/写配额(非常棒),但每100秒每个帐户限制为500个读/写,每100秒每个键有100个读/写(或者,我有发现,来自同一IP的多个密钥).这可能适用于大多数用例,但我有一个边缘案例,需要将经常更新的Google Sheet与70个选项卡一起下载到node.js服务器,该服务器每隔~30-60秒左右将这些选项分发给用户的客户端(用户)是作为学生研究助理的数据注释者.在项目早期没有那么糟糕的情况下,只有20-30个标签,但现在数据很大,服务器正在吹过100个配额并每10-15分钟返回错误.
问题是这样的:
是否有建议/方法来实现服务器的完整500次呼叫/ 100秒?
Google Sheets 文档可以包含一些工作表。首先是默认值和'0'。通常对于任何工作表都有这样的地址:
https://docs.google.com/spreadsheets/d/(spreadsheetId)/edit#gid=(sheetId)
与spreadsheetId和sheetId。
但是在API 文档中没有提到如何使用sheetId. 我只能阅读和编辑给定的默认工作表spreadsheetId。
如果在request示例链接中显示的代码中,我添加了sheetId属性,则出现错误:
{
message: 'Invalid JSON payload received. Unknown name "sheetId": Cannot bind query parameter. Field \'sheetId\' could not be found in request message.',
domain: 'global',
reason: 'badRequest'
}
Run Code Online (Sandbox Code Playgroud)
如何访问 Google Sheets API 中默认值以外的其他工作表并读取或更新其中的字段?
我正在尝试使用查询在我的Google工作表文件中的工作表上自动填充一些原始数据.
它似乎没有像Microsoft Excel那样具有任何内置功能.
我错过了什么吗?我发现一个附加组件已经停止使用,不再适用于所有地方的数据:https://www.dataeverywhere.com/use-database-sheets
还有其他东西已经取代了吗?
网络上有很多有关 OAuth 2、其不同类型的流程以及在何处/如何使用它们的信息。我发现这些资源中的大多数都讨论了对应用程序的用户进行身份验证,但我很难理解在使用第三方 API 时(即,当我们自己的 API 是用户与其用户之间的“中间人”时)最好/正确的方法是什么。第三方 API 中的数据)。
\n\n在示例场景和一些图表的帮助下,我将非常感谢您就如何正确实现与第三方 API 的集成以及每种方法的优缺点提供建议/意见。
\n\n首先,假设我们有一个 Web 应用程序,其结构如下:
\n\n现在假设我们希望添加与 Google Sheets 的集成。新功能将允许用户使用自己的 Google 表格(即存储在自己的 Google 帐户中)作为数据源,应用程序可以对该表格进行读写访问。将来可能会有其他集成,因此我假设其他 API 也需要类似的过程。
\n\n除了现有的 OAuth 流程(允许用户登录“MyApp”前端并与“MyApp API”通信)之外,还需要一个额外的 OAuth 流程,以便用户将 MyApp 连接到第三方Google Sheets API。
\n\n …authentication oauth oauth-2.0 google-oauth google-sheets-api
我目前正在跑步
library(googlesheets4)
sheets_auth()
dat=read_sheet("https://docs.google.com/spreadsheets/d/1R9XuH9Wej-p6HdkFGV2IsHuCmA9w0s7M3-jzE3S-Qrs/edit#gid=950673024", sheet="Summary", range=cell_rows(1:777))
Run Code Online (Sandbox Code Playgroud)
并得到以下输出。
Suitable tokens found in the cache, associated with these emails:
* dcallow@umd.edu
* ddcc2442@gmail.com
The first will be used.
Using an auto-discovered, cached token.
To suppress this message, modify your code or options to clearly consent to the use of a cached token.
See gargle's "Non-interactive auth" vignette for more details:
https://gargle.r-lib.org/articles/non-interactive-auth.html
The googlesheets4 package is using a cached token for dcallow@umd.edu.
>
> dat=read_sheet("https://docs.google.com/spreadsheets/d/1R9XuH9Wej-p6HdkFGV2IsHuCmA9w0s7M3-jzE3S-Qrs/edit#gid=950673024", sheet="Summary", range=cell_rows(1:777))
Error: Client error: (403) PERMISSION_DENIED
* …Run Code Online (Sandbox Code Playgroud) google-api ×3
android ×1
google-oauth ×1
hyperlink ×1
java ×1
oauth ×1
oauth-2.0 ×1
r ×1
spring-boot ×1