Create Google Sheet Cell

I am trying to find a way to change or record a cell in a google sheet. I was able to read my leaflet (on my disk) using the quick start guide (I copied and pasted this code: https://developers.google.com/sheets/quickstart/ios#step_3_set_up_the_sample ). I just changed the url:

https://sheets.googleapis.com/v4/spreadsheets/my_spreadsheet_Id/values/Feuil1!A1:F

.

But it is impossible to find the code for writing on the cells of my sheet ... when I look: https://developers.google.com/sheets/guides/values#methods . I do not understand where I should put my new data in the cell.

Example: I have β€œNew York” on cell A1. I want to change New York to Tahiti.

Do you know how to do this?

I tried this but did not work:

 - (void)modifyListe { NSString *baseUrl = @"https://sheets.googleapis.com/v4/spreadsheets/"; NSString *spreadsheetId = @"{MySpredsheet_ID}"; // choisir la bonne NSString *range = @"/values/Feuil1!G1:G1?valueInputOption=Tahiti"; baseUrl = [baseUrl stringByAppendingString:spreadsheetId]; baseUrl = [baseUrl stringByAppendingString:range]; [self.service fetchObjectWithURL:[NSURL URLWithString:baseUrl] objectClass:[GTLObject class] delegate:self didFinishSelector:@selector(displayMajorsWithServiceTicketT:finishedWithObject:error:)]; } 

SOLUTION: See the second message

-1
source share
1 answer

I think I found a solution (inspired by this post ):

 NSString *baseUrl = @"https://sheets.googleapis.com/v4/spreadsheets/MyspreadsheetID/values/Donnees!G1:G1?valueInputOption=USER_ENTERED"; NSURL *theURL = [NSURL URLWithString:baseUrl]; NSString *rangeKEY = @"range"; NSString *dimensionKEY = @"majorDimension"; NSMutableString *valuesKEY = [NSMutableString stringWithString:@"values"]; NSString *therange = @"Donnees!G1:G1"; NSString *themajorDimension = @"ROWS"; NSMutableString *string_Value = [NSMutableString stringWithString:@"theValue"]; NSMutableArray *ArrayOfString = [NSMutableArray array]; NSMutableArray *arrayOfArray = [NSMutableArray array]; [ArrayOfString addObject:string_Value]; [arrayOfArray addObject:ArrayOfString]; NSMutableDictionary *dicooo = [NSMutableDictionary dictionary]; [dicooo setObject:arrayOfArray forKey:valuesKEY]; [dicooo setObject:therange forKey:rangeKEY]; [dicooo setObject:themajorDimension forKey:dimensionKEY]; GTLObject *theobject ; theobject = [GTLObject objectWithJSON:dicooo]; [self.service fetchObjectByUpdatingObject:theobject forURL:theURL delegate:self didFinishSelector:@selector(displayMajorsWithServiceTicketT:finishedWithObject:error:)]; 

When I start, I see a modification on my sheet.

+1
source

All Articles