首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >查找使用C#在Sheets API中创建的google.sheet文件

查找使用C#在Sheets API中创建的google.sheet文件
EN

Stack Overflow用户
提问于 2021-01-21 04:03:19
回答 1查看 59关注 0票数 0

我正在使用Google.Apis.Sheets.v4

在我创建了一个凭证和一个初始化服务之后,我使用以下代码创建了一个电子表格:

service.Spreadsheets.Create(myNewSheet).Execute();

然后,使用SpreadsheetsID对新创建的电子表格执行更新或批量更新,如下所示:

SpreadsheetsResource.ValuesResource.UpdateRequest request = service.Spreadsheets.Values.Update(requestBody, awsomNewSheet.SpreadsheetId, range);

它是成功的,并得到了响应,但我在我的Google Drive上找不到新创建的文件。

有导游吗?

EN

回答 1

Stack Overflow用户

发布于 2021-01-21 05:24:04

它应该被创建并在您的Google Drive中可用。

但是作为一种变通方法,当您使用Spreadsheet.create()时,它将返回一个Spreadsheet Resource响应体。

我有三个选项供您选择:

  1. properties->title下的响应正文中获取文件的 title ,并使用以下搜索查询在Google Drive中搜索具有特定标题的文件:

title:<replace with your file title>

  1. 从响应正文中获取spreadsheetUrl,并使用该use访问您的文件

  1. 从响应正文中获取spreadsheetId,并使用该use通过以下链接访问您的文件:

https://docs.google.com/spreadsheets/d/<replace with spreadsheet id>/edit?

使用API资源管理器的示例响应正文:

代码语言:javascript
运行
复制
{
  "spreadsheetId": "1TNK_uduyRQ82TQQJ13qtLnu58bDZxxxxxx",
  "properties": {
    "title": "Sheet API Test",
    "locale": "en_US",
    "autoRecalc": "ON_CHANGE",
    "timeZone": "Etc/GMT",
    },
    
    .....
    
  "spreadsheetUrl": "https://docs.google.com/spreadsheets/d/1TNK_uduyRQ82TQQJ13qtLnu58bDZxxxxxx/edit?ouid=xxxxxx&urlBuilderDomain=example.com"
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65816816

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档