I am having problems with the border of the cell after sending request to change the font of the cell.
Here is my code:
$sheetId = "mySheetId" $spreadSheetId = "mySpreadSheetId" $requests = [ new Google_Service_Sheets_Request([ 'repeatCell' => [ 'cell' => [ 'userEnteredFormat' => [ "horizontalAlignment" => "CENTER", 'textFormat' => [ "foregroundColor" => [ "red" => 1 ], "bold"=>true ] ] ], 'range' => [ 'sheetId' => $sheetId, 'startRowIndex' => 11, 'endRowIndex' => 13, 'startColumnIndex' => 9, 'endColumnIndex' => 10 ], 'fields' => 'userEnteredFormat' ] ]) ]; $batchUpdateRequest = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest([ 'requests' => $requests ]); $response = $serviceGoogleSheet->spreadsheets->batchUpdate($spreadSheetId, $batchUpdateRequest);
Here is how it is before the change
After change, the text is changed to what I want but some lines in the border disappeared
Is there a way to keep it as old or I will have to add some update border in my request to change it back ?
In your situation, I thought that when the the value of
fields is modified, your issue might be able to be removed. So how about modifying your script as follows?
'fields' => 'userEnteredFormat'
'fields' => 'userEnteredFormat.horizontalAlignment,userEnteredFormat.textFormat'
'fields' => 'userEnteredFormat(horizontalAlignment,textFormat)'