API Updating Row Format

I was trying to find some documentation on the format string and came across this forum.

https://community.smartsheet.com/discussion/13111/update-row-background-with-api

I'm trying to update the format of an entire row ( mainly just trying to update the background color of an existing row ). In the forum above it says to simply add the format parameter to the update row request which sounds simple enough. However, I'm not entirely sure how to send the specified color into the format string. 

According to this resource, 

https://smartsheet-platform.github.io/api-docs/#formatting

The position of the background color is position 9 which is straightforward. My confusion is, why does the example value, 8, map to the hex color code xE6F5FE? Is there some sort of conversion that I'm missing or is there a set map of values to hex codes that I haven't seen?

Some additional information is that I'm doing this through a shell using cURL so if anyone provide any examples it would be amazing to have them in that format.

Answers

  • Hi @Jose Cardenas

    You are correct! There are numbers that correspond with the associated Hex colour codes. The list of Hex colour codes can be found in the FormatTables Object example, here.

    In my own testing, here are the numbers that I found go with each colour (I did a GET SHEET request which includes formatting and had a sheet set up with all the colours):


    I have the "value" from the cell in my sheet with the format listed below it. Here's what I found:


    Reds, Row 1:

    "value": "#991310",
    "format": ",,,,,,,,2,35,,,,,,,"
    
    "value": "#EA352E",
    "format": ",,,,,,,,,27,,,,,,,"
               
    "value": "#F87E7D",
    "format": ",,,,,,,,,19,,,,,,,"
    
    "value": "#FFCCD2",
    "format": ",,,,,,,,,11,,,,,,,"
                
    "value": "#FFEBEE",
    "format": ",,,,,,,,,4,,,,,,,"
    


    Oranges, row 2

    "value": "#EA5000",
    "format": ",,,,,,,,2,36,,,,,,,"
    
    "value": "#FF8D00",
    "format": ",,,,,,,,,28,,,,,,,"
           
    "value": "#FFCD7A",
    "format": ",,,,,,,,,20,,,,,,,"
               
    "value": "#FFE1AF",
    "format": ",,,,,,,,,12,,,,,,,"
             
    "value": "#FFF3DF",
    "format": ",,,,,,,,,5,,,,,,,"
    

    Yellows, Row 3

    "value": "#EBC700",
    "format": ",,,,,,,,2,37,,,,,,,"
    
    "value": "#FFED00",
    "format": ",,,,,,,,,29,,,,,,,"
                        
    "value": "#FEFF00",
    "format": ",,,,,,,,,21,,,,,,,"
    
    "value": "#FEFF85",
    "format": ",,,,,,,,,13,,,,,,,"
    
    "value": "#FFFEE6",
    "format": ",,,,,,,,,6,,,,,,,"
    


    Greens, Row 4

    "value": "#237F2E",
    "format": ",,,,,,,,2,38,,,,,,,"
    
    "value": "#40B14B",
    "format": ",,,,,,,,,30,,,,,,,"
                     
    "value": "#7ED085",
    "format": ",,,,,,,,,22,,,,,,,"
    
    "value": "C6E7C8",
    "format": ",,,,,,,,,14,,,,,,,"
     
    "value": "#E7F5E9",
    "format": ",,,,,,,,,7,,,,,,,"
    

    Blues, Row 5

    "value": "#0B347D",
    "format": ",,,,,,,,2,39,,,,,,,"
    
    "value": "#1061C3",
    "format": ",,,,,,,,,31,,,,,,,"
               
    "value": "#5FB3F9",
    "format": ",,,,,,,,,23,,,,,,,"
           
    "value": "#B9DDFC",
    "format": ",,,,,,,,,15,,,,,,,"
               
    "value": "#E2F2FE",
    "format": ",,,,,,,,,8,,,,,,,"
    


    Purples, Row 6

    "value": "#61058B",
    "format": ",,,,,,,,2,40,,,,,,,"
        
    "value": "#9210AD",
    "format": ",,,,,,,,,32,,,,,,,"
    
    "value": "#D190DA",
    "format": ",,,,,,,,,24,,,,,,,"
               
    "value": "#EBC7EF",
    "format": ",,,,,,,,,16,,,,,,,"
    
    "value": "#F4E4F5",
    "format": ",,,,,,,,,9,,,,,,,"
    

    Browns, Row 7

    "value": "#592C00",
    "format": ",,,,,,,,2,41,,,,,,,"
                   
    "value": "#974C00",
    "format": ",,,,,,,,,33,,,,,,,"
               
    "value": "#D0AF8F",
    "format": ",,,,,,,,,25,,,,,,,"
    
    "value": "#EEDCCA",
    "format": ",,,,,,,,,17,,,,,,,"
    
    "value": "#F2E8DE",
    "format": ",,,,,,,,,10,,,,,,,"
    

    Greys, Row 8

    "value": "#000000",
    "format": ",,,,,,,,2,1,,,,,,,"
              
    "value": "#757575",
    "format": ",,,,,,,,,34,,,,,,,"
    
    "value": "#BDBDBD",
    "format": ",,,,,,,,,26,,,,,,,"
    
    "value": "#E5E5E5",
    "format": ",,,,,,,,,18,,,,,,,"
     
    "value": "#FFFFFF",
    "format": ",,,,,,,,,2,,,,,,,"
    
    


    I hope this helps!

    Cheers,

    Genevieve

    Need more help? 👀 | Help and Learning Center

    こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions

  • Texmati
    Texmati ✭✭✭
    edited 08/28/24

    @Genevieve P. Thanks so much for this. The integers that reference colors don't seem to correspond to the index of the color list shown the the format table side-bar in the API, and figuring out how to get red text had me hashing rainbows for hours 😁.