如何解决查找使用 C# 在 Sheets API 中创建的 google.sheet 文件
我正在使用 Google.Apis.Sheets.v4
在创建凭据和初始化服务后,我使用以下内容创建了电子表格:
service.Spreadsheets.Create(Mynewsheet).Execute();
然后,使用 SpreadsheetsID 对新创建的电子表格进行更新或批量更新,例如:
SpreadsheetsResource.ValuesResource.UpdateRequest request = service.Spreadsheets.Values.Update(requestBody,awsomNewSheet.SpreadsheetId,range);
成功并收到回复,但我在 Google 云端硬盘中找不到新创建的文件。
有指导吗?
解决方法
它应该已在您的 Google 云端硬盘中创建并可用。
但作为一种解决方法,当您使用 Spreadsheet.create() 时,它会返回一个 Spreadsheet Resource 响应正文。
我有 3 个选择:
-
在
properties->title
下的响应正文中获取 file's title 并使用以下搜索查询在您的 Google Drive 中搜索具有特定标题的文件:title:<replace with your file title>
-
从响应正文中获取 spreadsheetUrl 并使用它来访问您的文件
-
从响应正文中获取 spreadsheetId 并使用它通过以下链接访问您的文件:
https://docs.google.com/spreadsheets/d/<replace with spreadsheet id>/edit?
使用 API Explorer 的示例响应正文:
{
"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"
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。