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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to enable HTML macro?

I have looked at the documentation on your site. But its from 2018 and it seems to have been updated since then. 

So how do I do to add html Macro?

My objective is to embed a google chart.

One way would be to insert Iframe though the iframe macro.

But I wanted to try this code:

function drawChart() {
var queryString = encodeURIComponent('SELECT A, B LIMIT 3 OFFSET 0');

var query = new google.visualization.Query('https://docs.google.com/spreadsheets/d/1xxxxxxxxxxxxxxxxedit?gid=0&headers=1&tq=' + queryString);
query.send(handleQueryResponse);
}

function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}

var data = response.getDataTable();
var chart = new google.visualization.ColumnChart(document.getElementById('columnchart'));
chart.draw(data, { height: 400});
}

 

How can I do that?

1 answer

Hi @Felix 

In the new editor type /iframe and then click to edit the macro. A form appears and you have various options.

Whether your functions works is another story. 

In the old editor, type {iframe  - and choose between HTML/Iframe Macro or Iframe. Again you will need to play around with the form fields. 

-Mike

@Mike Bowen Thanks for looking into it. I don't see how I can add my code to test it though.

Hi @Felix 

No, I didn't think you could, as it is a very basic iFrame, I am guessing Atlassian don't want their website / cloud to broken by a rouge script. 

 

-Mike

Hi @Mike Bowen

That makes totally sense :) Thanks again. There was a much easier way to do what I wanted from /iframe macro. It was possible to "publish" the google sheets graf itself and add that URL in the macro. Simple as that :D

Hi @Felix 

Well good for finding a solution.

There are some clever plugins that allows Google Drive files or folders to be inserted within the page. It is called Google Drive and Docs for Confluence 

Google Drive.jpg

-Mike

@Mike Bowen  Ahh, really nice! Thanks for the tip!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Share your Confluence Cloud experience for a chance to win $500!

Take our 5-minute survey to win a $500 Visa gift card! Are you currently using Confluence Cloud? We want to hear from you! Fill out this quick survey about your Confluence Cloud experience so we ...

677 views 7 19
Read article

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