How to copy specific content in confluence wiki pages from one page to other?
Asked by Vivek Singh:

Hi there,

I am trying to copy rows from a table based on specific text in a column from one confluence page to other. I looked for 'Excerpt' macro option to do this task but seems like there is no option to do this based on specific text.

![Confluence_Img.JPG](/t5/image/serverpage/image-id/91796iA204BC558B974960/image-size/large?v=v2&px=999 "Confluence_Img.JPG")

In the above table, I want to copy rows where Status column contains 'Load Complete' or row color is blue, whichever option is feasible.

Thanks for the help.

Vivek


Answers:
author: Dominic Lagger
body: Hi [@Vivek Singh](/t5/user/viewprofilepage/user-id/3870606)

Do you want the content to be updated automatically from the table?

I don't think this is possible. And sadly, I can't imagine any workaround or another solution for that. I'm sorry.

The only thing you could do is check out this plugin:

* [Table Filter and Charts for Confluence](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=server&tab=overview)
* There you have two table excerpt macros, which can duplicate tables. You also have multiple other cool table features, but I don't think of any where you can choose specific rows and display them on another page
  * [How to use Table Excerpt and Table Excerpt Include macros](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Excerpt+and+Table+Excerpt+Include+macros)

Regards, Dominic

comments: author: Vivek Singh
body: Thank you [@Dominic Lagger](/t5/user/viewprofilepage/user-id/601600) for helping out.

Is it possible to achieve the above task using REST API, i haven't worked on it but I have seen it as an option on doing these operations on other forums.

Regards,

Vivek Singh


author: Dominic Lagger
body: Hi [@Vivek Singh](/t5/user/viewprofilepage/user-id/3870606)

It would be possible, but a really bad hack (in my opinion)

First, you would have to get the page content where the table is stored. You need the [GetContent](https://docs.atlassian.com/ConfluenceServer/rest/7.2.0/#api/content-getContent) funcction.

    http://example.com/confluence/rest/api/content?spaceKey=TST&title=Cheese&expand=space,body.view,version,container

Then you have to parse the content by your own. So here you have to search the table. One you get the table, you can parse, where the background-color is blue or where the state is 'Load Complete'.

If you want to do it with an own user macro and velocity, it will be really hard work (and a lot of try and error). If you want it with python, you should be able to achive this.

If you achieved it, let us all know :)


author: Vivek Singh
body: Thanks [@Dominic Lagger](/t5/user/viewprofilepage/user-id/601600) for the quick response, really appreciate that :)

Other thing I have in mind is, how to have some validations on my confluence page? For e.g. in a particular section in the page I want to check if names have an email hyperlink or not? Is it also possible only through REST or there are other easier options available.

Regards,

Vivek Singh


author: Dominic Lagger
body: It depends how the names are recognisable? Do you need to check always just 5 names? Or all names which could appear on a page?

What you could do is writing a user macro which do it for you. But as before, you get the page content and have to parse the page. If you can spot the names with a parser, then it's possible.

In confluence, again, the possibility is to write a user macro. But user macros are written in "velocity". So this would be very tricky to make such a check.


author: Vivek Singh
body: Thank you [@Dominic Lagger](/t5/user/viewprofilepage/user-id/601600) :).

Will reach out in case of any other questions.


Tags: confluence-server

server