I have been working on Google SpreadSheet API in iOS swift, but theres a problem in updating a specific field in SpreadSheet row/data in iOS Swift,
Following is the code
You should define an exact range for a cell you are going to update. It might look like this:
let service = GTLRSheetsService()
service.authorizer = GIDSignIn.sharedInstance().currentUser.authentication.fetcherAuthorizer()
service.apiKey = Constants.GOOGLE_SPEADSHEET_API_KEY
let rowIndex:Int = job.rowIndex
let range = "Employee List!C\(rowIndex):C\(rowIndex)"
let valueRange = GTLRSheets_ValueRange()
valueRange.range = "Employee List!C\(rowIndex):C\(rowIndex)"
valueRange.values = [[job.jobTitle!]]
valueRange.majorDimension = "COLUMNS"
let query = GTLRSheetsQuery_SpreadsheetsValuesUpdate.query(withObject: valueRange, spreadsheetId: Constants.SPREAD_SHEET_ID, range: range)
query.valueInputOption = "USER_ENTERED"
service.executeQuery(query) { (ticket, response, error) in
print(response)
}
And don't forget to define a right scope
in GIDSignIn.sharedInstance().scopes