Better late than never!?
Well I also had the same problem but I needed to change multiple fields, I even looked at the links above but nothing in php. The code below also works if you need to change just one field or several. (google translate)
<?php
$myvalue = 'NEW VALUE';
$values = [[$c_id,]];
// make conn with credentials
$client = new \Google_Client();
$client->setApplicationName('Google Sheets with PHP');
$client->setScopes([\Google_Service_Sheets::SPREADSHEETS]);
$client->setAccessType('offline');
$client->setAuthConfig(__DIR__ . '/cred.json');
$service = new Google_Service_Sheets($client);
$spreadsheetId = "your-id";
// insert custom range to match with name of spreadsheet and range to search
$range = "COMPLETO!A2:A50000";
$cell_id;
$cell_range;
$response = $service->spreadsheets_values->get($spreadsheetId, $range);
$values_r = $response->getValues();
if (empty($values_r)) {
print "None Found.\n";
} else {
print "Data found\n";
$range_index = '1';
foreach ($values_r as $row) {
// Show the results in array
$range_index++;
// Match com id do banco de dados
if($row[0] === $c_id){
echo "ID found\n";
echo "$row[0]\n";
echo "Cell ID A${range_index}\n";
$cell_id = "A${range_index}";
// in $cell_range set the effective range to change
// $cell_range = "A${range_index}:CM${range_index}";
break;
}
}
}
$body = new Google_Service_Sheets_ValueRange([
'values' => $values
]);
// try Update
$append_sheet = $service->spreadsheets_values->update($spreadsheetId, $cell_range, $body,['valueInputOption' => 'RAW']);
echo "Update Google Sheet\n";
$conn = null;
?>