1

I am trying to change cell format to plain text from google api: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate

Doing it directly from google drive gives me a completely different result than doing it from the API.

I add the following examples of what I am trying to do.

This is from the spreadsheet formatting:

  1. This is the field I want to format as plain text

enter image description here

  1. This is what I do

    Format > Number > Plain Text

  2. This is the result:

enter image description here

This is what happens when I format it from the google API with the above JSON:

  1. This is the field I want to format:

enter image description here

  1. This is the XML that I am applying from the API:

         "requests": [
           {
             "repeatCell": {
               "range": {
                 "sheetId": 3,
                 "startColumnIndex": 2,
                 "endColumnIndex": 3,
                 "startRowIndex": 16,
                 "endRowIndex": 17
               },
               "cell": {
                 "userEnteredFormat": {
                   "numberFormat": {
                     "type": "TEXT"
                   }
                 }
               },
               "fields": "userEnteredFormat.numberFormat"
             }
           }
         ]
       }```
    
    
  2. This is the result of applying the format from the API:

enter image description here

My problem: how can I get the same thing from the API as from the sheet? What do I have to change in the JSON to correctly apply the format?

stark
  • 59
  • 1
  • 7
  • Could you share a sample sheet to check the behavior? Always try to include a [minimal example](https://stackoverflow.com/help/minimal-reproducible-example) – Gabriel Carballo Feb 28 '22 at 17:46
  • @GabrielCarballo I just included an example of how I am doing the procedures – stark Mar 04 '22 at 10:07
  • Does this thread answer your question? https://stackoverflow.com/questions/71361965/format-cells-in-google-sheets-from-api-v4 it seems that there is no direct way to directly set the text as plain text. – Gabriel Carballo Mar 07 '22 at 16:25

0 Answers0