问题
I have used the bellow code to add row in spreadsheet (List-based feed) but it not works ...
NSMutableArray * array = [[NSMutableArray alloc] init];
GDataEntrySpreadsheetList *listEntry = [GDataEntrySpreadsheetList listEntry];
GDataSpreadsheetCustomElement *serialNo = [GDataSpreadsheetCustomElement elementWithName:@"SNo" stringValue:@"1"];
[array addObject:serialNo];
[listEntry setCustomElements:array];
//then after finding the worksheet
GDataServiceGoogleSpreadsheet *service = [self spreadsheetService];
NSURL *feedURL = [addedWorkSheet listFeedURL];
[service fetchEntryByInsertingEntry:listEntry
forFeedURL:feedURL
delegate:self
didFinishSelector:@selector(addEntry:finishedWithFeed:error:)];
The above code gives error like:
error::-Error Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be completed. (We're sorry, a server error occurred. Please wait a bit and try reloading your spreadsheet.)" UserInfo=0x5fe2de0 {NSLocalizedFailureReason=(We're sorry, a server error occurred. Please wait a bit and try reloading your spreadsheet.), error=We're sorry, a server error occurred. Please wait a bit and try reloading your spreadsheet.}
Please help me to solve this error.
Thanks in advance.
回答1:
This very misleading error can occur if the GDataEntrySpreadsheetList you're trying to insert contains no GDataSpreadsheetCustomElements that are relevant to the worksheet.
When creating a GDataSpreadsheetCustomElement, the string you use for "name" must match the value in the first row of the spreadsheet for the column you're interested in, EXCEPT that it must be converted to all lower-case and have all spaces removed.
Try replacing elementWithName:@"SNo" with elementWithName:@"sno"
来源:https://stackoverflow.com/questions/7816634/add-row-in-spreadsheet-list-based-feed-but-it-not-works