Add row in spreadsheet (List-based feed) but it not works

℡╲_俬逩灬. 提交于 2019-12-10 15:44:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!