As a developer i use this endpoint: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
And request: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AppendCellsRequest to insert new row with values.
I have spreadsheet with some column format styles: background-color/font-weight/text-wrap/data-validation.
The problem, when i use requests like this:
curl --request POST \
'https://sheets.googleapis.com/v4/spreadsheets/1SoDx8YRyiKF9vKfa_2w0xc7DTNIlQoLC6hBq1SCJEJY:batchUpdate?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"requests":[{"appendCells":{"sheetId":0,"fields":"*","rows":[{"values":[{"userEnteredValue":{"stringValue":"TEST STRING VALUE long"}},{"userEnteredValue":{"stringValue":"TEST TEXT LONG"}}]}]}}]}' \
--compressed
I see that text-wrap and data-validation styles are ignored:
Key point here that i use only: 'userEnteredValue' field to provide values.
According to the doc: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#CellData i can use 'userEnteredFormat'/'dataValidation', but "When writing, the new format will be merged with the existing format." I find it quite complicated to obtain and post those style formats once again.
My question - is there any way to just post CellData using AppendCellsRequest as simple as possible and preserve existing column styles?



I see that text-wrap and data-validation styles are ignored:from your image. Can I ask you about the detail of it? - Tanaike