Is it possible to color a table row based on the value of a column
Asked by Alexander Stoyanov:

I have a table that is build from data coming from an outside source. I want each row to be colored in a color that is comming from a column named Color, which contains RGB value of a color.

Is this possible?


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@Alexander Stoyanov](/t5/user/viewprofilepage/user-id/4151659) ,

You may try the [Table Filter and Charts for Confluence](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=server&tab=overview) app.

Wrap you table in the [Table Transformer](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro) macro and apply conditional formatting with the help of the Wiki markup:

![Fri 1-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/117344iAC64AEC5BC0F3A39/image-size/large?v=v2&px=999 "Fri 1-1.png")

Type in your custom SQL query:

![Fri 1-2.png](https://community.atlassian.com/t5/image/serverpage/image-id/117345i5ABADB930AF91EE6/image-size/large?v=v2&px=999 "Fri 1-2.png")

SELECT  
FORMATWIKI("{cell:bgColor=" +  
CASE WHEN T1.'Color' LIKE "(122,28,134)" THEN "#7a1c86"  
WHEN T1.'Color' LIKE "(10,186,181)" THEN "#0abab5"  
ELSE "#ccff00"  
END  
+ "}" + T1.'Column A' + "{cell}") AS 'Column A with Background',  
FORMATWIKI("{cell:bgColor=" +  
CASE WHEN T1.'Color' LIKE "(122,28,134)" THEN "#7a1c86"  
WHEN T1.'Color' LIKE "(10,186,181)" THEN "#0abab5"  
ELSE "#ccff00"  
END  
+ "}" + T1.'Column B' + "{cell}") AS 'Column B with Background',  
FORMATWIKI("{cell:bgColor=" +  
CASE WHEN T1.'Color' LIKE "(122,28,134)" THEN "#7a1c86"  
WHEN T1.'Color' LIKE "(10,186,181)" THEN "#0abab5"  
ELSE "#ccff00"  
END  
+ "}" + T1.'Color' + "{cell}") AS 'Color with Background'  
FROM T\*

And preview the result:

![Fri 1-3.png](https://community.atlassian.com/t5/image/serverpage/image-id/117347iF306CE1C4504BA42/image-size/large?v=v2&px=999 "Fri 1-3.png")

And what concerns uploading your source table from the external source, the app also provides the [Table from CSV](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+from+CSV+macro) and [Table from JSON](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+from+JSON+macro) macros that support outputting data from a URL or an attached file.

comments: author: Alexander Stoyanov
body: Thanks for the replay [@Katerina Kovriga {Stiltsoft}](/t5/user/viewprofilepage/user-id/1464746) . It looks very promising and I was not aware of the table transformer macro. When I paste your code with the sample table you have provided I get

TypeError: alasql.fn.FORMATWIKI is not a function

Where is FORMATWIKI defined?


author: Dom
body: I get TypeError: alasql.fn.FORMATWIKI is not a function as well.


author: Katerina Kovriga {Stiltsoft}
body: [@Alexander Stoyanov](/t5/user/viewprofilepage/user-id/4151659) , [@Dom](/t5/user/viewprofilepage/user-id/423404) , please, check if the version of the Table Filter and Charts for Confluence app is **6.1.0 or newer**.

Here is our [documentation](https://docs.stiltsoft.com/display/public/TFAC/Advanced+table+cells+formatting) about cells formatting with the Table Transformer macro. You'll find a lot of use cases there.

If the version of the app is up-to-date but you still can't reproduce our examples, please, raise a support ticket (specify the version of the app and attach your screenshots, we'll investigate the issue).


author: Dom
body: Behind on the version; the major version update has to be vetted so I can't just click the update button. :)  

I imagine I will not have any problem once I can update. Thanks!


author: shunquan shen
body: If the table is generated by "table from json" macro, can " [Table Transformer](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro)" macro be used ?


author: Katerina Kovriga {Stiltsoft}
body: Yes, all our macros are compatible. So, you can wrap your Table from JSON macro in the Table Transformer, Table Filter, Pivot Table macro, etc. and further transform, filter and aggregate your table.


author: Stiltsoft support
body: And you may also use the [Spreadsheet from Table](https://docs.stiltsoft.com/tfac/cloud/spreadsheet-from-table-152142229.html?utm_source=atl_community&utm_medium=answer&utm_campaign=table-filter-traffic-sources&utm_vendorID=1216111) macro for the case: turn your manually created or macro generated tables into live spreadsheets and apply familiar Excel-like conditional formatting.


Tags: atl-gruland

confluence-server

filter

server

spreadsheet

table

table-filter

table-filter-and-charts

table-filter-charts-spreadsheets

table-spreadsheet

table-transformer