# Export Perspective Power table data and format to Excel

**URL:** <https://forum.inductiveautomation.com/t/export-perspective-power-table-data-and-format-to-excel/83584>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 28, 2023, 8:19pm UTC](https://forum.inductiveautomation.com/t/export-perspective-power-table-data-and-format-to-excel/83584 "2023-12-28T20:19:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![beckya](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@beckya](https://forum.inductiveautomation.com/u/beckya)\
**Post date:** [December 28, 2023, 8:19pm UTC](https://forum.inductiveautomation.com/t/export-perspective-power-table-data-and-format-to-excel/83584/1 "2023-12-28T20:19:28Z")

</div>

Using this documentation to make my table rows different colors based on the value of one of the columns.

[https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Table#PerspectiveTable-Example1:StylingRowsBasedonValue-JSONData](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Table#PerspectiveTable-Example1:StylingRowsBasedonValue-JSONData)

> `# This list will be used to create a JSON like structure that will insert rows for our styles`
> 
> `output_json ` `=` `[]`
> 
> `# Here we can define what styling on our rows will be.`
> 
> `style_orange ` `=` `{` `"backgroundColor"` `: ` `"#F7901D"` `}`
> 
> `style_green ` `=` `{` `"backgroundColor"` `: ` `"#00AA00"` `}`
> 
> `# You could change more than just the background color, for example:`
> 
> `# style_another_example {"backgroundColor": "#00AA00", "font-weight": "bold"}`
> 
> `for` `row ` `in` `range` `(value.getRowCount()):`
> 
> ` ` `row_object ` `=` `{}`
> 
> ` ` `row_value ` `=` `{}`
> 
> ` ` `row_style ` `=` `{}`
> 
> ` ` `for` `col ` `in` `range` `(value.getColumnCount()): `
> 
> ` ` `row_value[value.getColumnName(col)] ` `=` `value.getValueAt(row, col)`
> 
> ` ` `row_object[` `'value'` `] ` `=` `row_value`
> 
> ` `
> 
> ` ` `# Here we're checking the name of the column that we want to base our styling on.`
> 
> ` ` `if` `value.getColumnName(col) ` `=` `=` `'B'` `:`
> 
> ` `
> 
> ` ` `# Here we're checking for individual values within the column, and applying styling`
> 
> ` ` `if` `value.getValueAt(row, col) ` `=` `=` `'One'` `:`
> 
> ` ` `row_style ` `=` `style_orange`
> 
> ` ` `elif` `value.getValueAt(row, col) ` `=` `=` `'Two'` `:`
> 
> ` ` `row_style ` `=` `style_green`
> 
> ` `
> 
> ` ` `row_object[` `'style'` `] ` `=` `row_style`
> 
> ` ` `output_json.append(row_object)`
> 
> `return` `output_json`

Is there a way to export the data to excel and maintain the color formatting?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 28, 2023, 9:00pm UTC](https://forum.inductiveautomation.com/t/export-perspective-power-table-data-and-format-to-excel/83584/2 "2023-12-28T21:00:05Z")

</div>

Hi, beckya. Please have a read of [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831) and then hit the pencil icon below your post to format the code.
