Replicating table and adding columns
Asked by Choy Fong Chan:

We are trying to replicate a table from one Confluence space/page (Space #1) to another Confluence space/page (Space #2), so that the table can be automatically updated in Space #2 whenever we update the table in Space #1.

In addition, we would also like to add a few more columns to the table in Space #2 for direct edits in Space #2.

1) Can we use the "Excerpt Include" macro function to replicate and link the table in Space #2?

2) Can anyone advise how to add columns for direct edits in Space #2?

Thank you.


Answers:
author: Natalie Paramonova [Stiltsoft]
body: Hello,

I think I have a solution for your use case. The [Table Filter and Charts](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=server&tab=overview) app starting from the version 5.0.0 includes the [Table Transformer](https://docs.stiltsoft.com/display/TableFilter/How+to+use+Table+Transformer+macro) macro that provides merging tables.

The steps are the following:

1. Wrap the table in Space#1 in the Excerpt or [Table Excerpt](https://docs.stiltsoft.com/pages/viewpage.action?pageId=17301667#HowtouseTableExcerptandTableExcerptIncludemacros-UsingtheTableExcerptMacro) (included in Table Filter and Charts) macros.

![2019-03-29_11h37_24.png](https://community.atlassian.com/t5/image/serverpage/image-id/49935i8A90473733683977/image-dimensions/477x319?v=v2 "2019-03-29_11h37_24.png")

2. Insert the table in Space #2 using the Excerpt Include or [Table Excerpt Include](https://docs.stiltsoft.com/pages/viewpage.action?pageId=17301667#HowtouseTableExcerptandTableExcerptIncludemacros-UsingtheTableExcerptIncludeMacro) macros.

![2019-03-29_11h38_57.png](https://community.atlassian.com/t5/image/serverpage/image-id/49934i8BEDD08287B7D217/image-dimensions/534x332?v=v2 "2019-03-29_11h38_57.png")

3. Wrap the Excerpt Include or Table Excerpt Include macro with the [Table Transformer](https://docs.stiltsoft.com/display/TableFilter/How+to+use+Table+Transformer+macro?src=contextnavpagetreemode) macro.

![2019-03-29_11h39_48.png](https://community.atlassian.com/t5/image/serverpage/image-id/49930iF64FFC99DA1B9325/image-dimensions/448x165?v=v2 "2019-03-29_11h39_48.png")

4. Place the second table you want to edit in Space #2 in the macro body.

![2019-03-29_11h40_14.png](https://community.atlassian.com/t5/image/serverpage/image-id/49932iA2684F8C6855AF29/image-dimensions/525x343?v=v2 "2019-03-29_11h40_14.png")

5. Select the [Lookup tables](https://docs.stiltsoft.com/display/TableFilter/Default+automatic+presets#Defaultautomaticpresets-Lookuptablespreset)preset in the Table Transformer macro to merge two tables.

![2019-03-29_11h40_37.png](https://community.atlassian.com/t5/image/serverpage/image-id/49933i7A46A2A1250AE39D/image-dimensions/519x306?v=v2 "2019-03-29_11h40_37.png")

As a result, the merged table will be automatically updated after changing both the table in Space #1 and the table in Space #2.

![2019-03-29_11h41_17.png](https://community.atlassian.com/t5/image/serverpage/image-id/49931iCB281577846ACF69/image-dimensions/561x195?v=v2 "2019-03-29_11h41_17.png")

Please let me know if it helps.


author: GJ
body: If you only wanted to add a column with static data, you can do so by editing the SQL in the Table Transformer macro. This is useful if you want to place this table inside a Pivot Table macro and you want to identify the source tables.

For example:

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

++SQL query++:

SELECT \*, "\<insert static data\>" AS '\<insert column name\>'  
FROM T1


author: Dominic Lagger
body: Hi [@Choy Fong Chan](/t5/user/viewprofilepage/user-id/2881534)

1. I would say yes, you can use *Excerpt Include* for this.
2. If you use *Excerpt Include*, you do not have the opinion to add columns only in space #2, because it is an excerpt from space#1. To add columns just in space#2, you will have to copy paste the values and make a new table

comments: author: Choy Fong Chan
body: Thank you!!


Tags: confluence-server

filter

server

table

table-filter

table-filter-and-charts