I'm trying to write an iPhone app that stores its database in a Google spreadsheet. I followed the DrEdit example here which uses the Drive API to read/write plain text files to Google Drive. I'm trying to modify the example app to work with spreadsheets instead. I was able to upload a csv file and ask Google to convert it. However, what I really want is to directly work with mimeType: "application/vnd.google-apps.spreadsheet". I'm very new at this and it would be extremely helpful if someone could point me to an example. For starters, I'd like to achieve something like the following
- (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];
}
Also, is Google Drive API the right thing to use? Ultimately, I want to have the ability to update selected cells of a spreadsheet instead of uploading an entire document. I found some other options such as the gdata api and spreadsheet api, but it seems that Drive API is the newest and it's supposed to contain the functionalities of the other two?
Thanks in advance!
You should use the Google Spreadsheets API to directly manipulate the cells of a spreadsheet:
https://developers.google.com/google-apps/spreadsheets/
The Spreadsheet API is supported by the Google Data APIs Objective-C Client Library which also includes some samples that you can use as reference: