Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Query regarding custom user macro for importing MS Excel data

Hello Confluence Experts,

I have a use case wherein I need to import a MS Excel data into Confluence.

One excel row needs to be created as one new page and columns in that excel needs to mapped/linked to another existing static pages in the the same Confluence space.

By reading some Confluence docs, I got to know that I might need to create a new custom User Macro to perform this import.

Can any expert guide me further Or if someone working on similar macro help me out to do it fast?

 

Thanks in advance.

1 comment

Dominic Lagger
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 14, 2022

Hi @Ashutosh Dwivedi 

You do not need a user macro for this.

What you need is a script (Python or something else) which uses the REST API from confluence to create the pages. 

All about REST API is here: https://docs.atlassian.com/ConfluenceServer/rest/7.16.2/ 

You will need the Create Content section.

Regards, Dominic

Like Ashutosh Dwivedi likes this

Hi @Dominic Lagger 

Thanks for your valuable suggestion.

Do you have any sample script calling Content creation APIs of Confluence?

If yes, that would be really great. 

 

Thanks..!!

Dominic Lagger
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 14, 2022

this is a main part of creating a new page in confluence

mypage = {"type":"page","title":""+NEWPAGENAME+"","ancestors":[{"id":PARENTID}],"space":{"key":""+SPACEKEY+""},"body":{"storage":{"value":"" + PAGE_IN_STORAGE_FORMAT+ "", "representation": "storage"}}}
post = requests.post(url+'/rest/api/content/', data=json.dumps(mypage), auth=auth, headers=headers, verify=False)
newpageId = json.loads(post.text)['id']

You need auth and headers:

headers = {
'X-Atlassian-Token': 'no-check',
'Content-Type': 'application/json'
}
auth=(user, password)

This is written in python

Regards, Dominic

Like Ashutosh Dwivedi likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events