我正在嘗試編寫一個將其數據庫存儲在Google電子表格中的iPhone應用程序。我遵循DrEdit示例here,該示例使用Drive API將純文本文件讀取/寫入Google Drive。我試圖修改示例應用程序來使用電子表格。我能夠上傳一個CSV文件並要求Google將其轉換。不過,我真正想要的是直接使用mimeType:「application/vnd.google-apps.spreadsheet」。我對此很新,如果有人能指點我一個例子,這將非常有幫助。對於初學者,我想實現類似以下內容如何在iOS上使用Google Drive API處理電子表格
- (void)uploadSpreadSheetWithThreeCells {
GTLUploadParameters *uploadParameters = nil;
NSString *data = @"cell1,cell2,cell3";
NSData *spreadSheetContent = nil;
/*
How to initialize spreadSheetContent with data?
*/
[GTLUploadParameters uploadParametersWithData:spreadSheetContent
MIMEType:@"application/vnd.google-apps.spreadsheet"];
GTLQueryDrive *query = [GTLQueryDrive queryForFilesInsertWithObject:self.driveFile
uploadParameters:uploadParameters];
[self.driveService executeQuery:query completionHandler:nil];
}
此外,Google Drive API是否正確使用?最終,我希望能夠更新電子表格的選定單元格,而不是上傳整個文檔。我發現了一些其他選項,如gdata api和電子表格api,但似乎Drive API是最新的,它應該包含另外兩個的功能?
在此先感謝!
有你能更新谷歌雲端硬盤電子表格:你可以作爲參考使用?你能否更新你的代碼?我有同樣的問題,更新一個非常簡單的谷歌公共表的3個領域。 – doxsi