It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there a macro for data tables where we can provide columns and data and it creates table on page?

I have a requirement to programmatically add a table similar to html tables on a confluence page. I know I can add an html table in the html macro but i don't want that. Is there another option besides that?

1 answer

1 accepted

Hi Ahmad,

I'm not quite sure I understand your question correctly. Do you have data somewhere (e.g. in a Database or accessible via REST) and want to display it in a Confluence page as a table? Or do you want just a static table? Maybe you could give an example of what you mean. :)

Also: are you on Server or Cloud?

Cheers,
Sven

Hi Sven,

I have an application which creates and updates pages on a space in confluence. So, I have data on my application server. I want to create a table on confluence using that data and using REST calls of confluence. For example, is there any option or endpoint where I can pass in the data and column names and page Id and confluence creates and populates the table automatically for me on that page.

Thanks.

Hmmm... I'm not 100% percent sure I fully understand what you want to do yet, but it does sound like our app PocketQuery could be the solution to your problem. (You didn't say whether you're on Server or Cloud - if you're on Cloud you can pretty much stop reading here, because it's not available there yet)

With PocketQuery you could define a REST Query that fetches data from your external server. You can then insert the PocketQuery macro into page which will execute and render your REST Query into a table.

The only thing is that depending on the layout of your data, you might need to write a PocketQuery Converter or a PocketQuery Template. But I can help you with that, if you want to do that. :)

Let me know if this actually sounds like a solution to your problem of if you want to do something else!

Cheers,
Sven

Let me explain with help of an example. For example, I have data like this in my application server e.g. column names: name,id,date and I have arrays or lists of values for these three columns. Now I want to create a data table on a confluence page programmatically using this data. So, is there a macro available for this where I can pass this data as parameters to macro. 

I looked here for all the macros available: https://confluence.atlassian.com/display/CONF55/Working+with+Macros. But I didn't find one for simple data table or html table.

PocketQuery does sound like a possible solution, but if there is a macro other than that, it will be really helpful.

And yes, I am on server not on cloud.

Thanks.

Hi @Ahmad Raza,

sounds really like PocketQuery would exactly do what you need. There definitely isn't a standard Confluence macro that does anything like that. You will need some kind of Marketplace App or code a User Macro or Custom Plugin yourself. 

Bonus: You can also use PocketQuery to connect to JDBC databases and display SQL results in your Confluence, using a macro. Maybe that's even a better approach in your case (depending on whether you have access to the database).

Cheers,
Sven

Like Dominic Lagger likes this

Alright, Thank you for your help Sven.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,531 views 6 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you