我正在使用Google.Apis.Sheets.v4
在我创建了一个凭证和一个初始化服务之后,我使用以下代码创建了一个电子表格:
service.Spreadsheets.Create(myNewSheet).Execute();
然后,使用SpreadsheetsID对新创建的电子表格执行更新或批量更新,如下所示:
SpreadsheetsResource.ValuesResource.UpdateRequest request = service.Spreadsheets.Values.Update(requestBody, awsomNewSheet.SpreadsheetId, range);
它是成功的,并得到了响应,但我在我的Google Drive上找不到新创建的文件。
有导游吗?
发布于 2021-01-20 21:24:04
它应该被创建并在您的Google Drive中可用。
但是作为一种变通方法,当您使用Spreadsheet.create()时,它将返回一个Spreadsheet Resource响应体。
我有三个选项供您选择:
properties->title
下的响应正文中获取文件的 title ,并使用以下搜索查询在Google Drive中搜索具有特定标题的文件:title:<replace with your file title>
https://docs.google.com/spreadsheets/d/<replace with spreadsheet id>/edit?
使用API资源管理器的示例响应正文:
{
"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"
}
https://stackoverflow.com/questions/65816816
复制