【发布时间】:2016-07-06 09:35:58
【问题描述】:
目前,我们正在使用 DriveService 创建电子表格。它使用单张纸创建电子表格。使用的代码如下:
DriveService service = new DriveService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = applicationName });
Google.Apis.Drive.v2.Data.File body = new Google.Apis.Drive.v2.Data.File();
body.Title = uploadSpreadsheetRequest.FileName;
body.Description = uploadSpreadsheetRequest.FileName;
body.MimeType = "text/csv";
byte[] byteArray=System.IO.File.ReadAllBytes(uploadSpreadsheetRequest.FilePath);
System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, "text/csv");
request.Convert = true;
request.Upload();
有什么方法可以修改我的代码来创建一个包含多张工作表的电子表格。
我可以通过使用 Google Sheets API 来做到这一点,但我希望通过使用字节来实现。
有人可以帮我解决这个问题吗?
【问题讨论】:
-
我不这么认为。请注意,您可能想查看 Google Drive api 的 V3 没有理由真正使用旧版本。
标签: c# google-sheets google-drive-api google-spreadsheet-api google-sheets-api