Embedding
Embed your reports across the web and in internal tools
Overview
When you upload a report to a Datapane instance, you can embed it into other platforms, such as in these docs,
Or on other platforms like Medium and Notion,
Datapane reports can be embedded into any websites that supports either HTML iframes
or the oEmbed protocol. Sites that support oEmbed allow you to just paste the link to the report, and will handle the embedding automatically. Sites that support iframes, including your own websites and pages, simply require you to copy and paste the embed code from your report page on Datapane. You can find examples of embedded reports throughout these docs.
We support the following third-party sites, and any others that are compatible with either oEmbed or HTML iframes.
Site | Embed Type |
---|---|
Notion | oEmbed |
Confluence | HTML iframe |
Coda | oEmbed |
oEmbed | |
Medium | oEmbed |
Salesforce | HTML iframe |
Personal / Internal sites and pages | HTML iframe |
Info
Embeds work great with the Adding Source Code feature, so viewers can see your source code to understand how you built your report.
Business Integrations
Notion
If you are already using Notion in your company, and you're comfortable analyzing data using Python, you might not need to buy a clunky BI tool. Instead, you can generate interactive, dynamic reports in Python and embed them straight into your Notion documents.
To embed the chart in Notion, just paste the link into any page. A menu will pop up asking you Create Embed. If you click this, Notion will embed your report inside your page.
Confluence
You can embed a Datapane report into Confluence using an iframe, but instead of copying the code tag like you do when embedding in your own website, you need to use Confluence's built-in iframe support.
On your Confluence page, type /iframe
and the iframe popup will appear.
Similarly to when you are embedding in your own website, when you embed into Confluence, make sure you add /embed
to the end of your URL, as Confluence does not automatically add it as Notion, Medium, and Reddit do.
Confluence will then display your report or visualization in the page:
Personal / Internal / Company websites
You can embed into your own website using an iframe. After uploading your report, select Embed in the share menu on the report. This will provide a simple piece of HTML code that you can copy and paste into your webpage.
Datapane Teams also provides the ability for private reports, which can be securely embedded in your own tools to make use of Datapane reports across your applications.
Info
You can use this method on any website where you control the underlying HTML code.
Social Integrations
Embed in Medium
To embed a report on Medium, upload it to Datapane, and copy and paste the full URL of your report into your Medium editor. Medium will automatically create the embed, and you will see the following. In edit mode, your embed will not be interactive - you must publish the post first to use interactive elements.
Export to Medium
Write a lot on Medium? Datapane lets you convert your existing Datapane reports into Medium story drafts, preserving formatting and layout while making all visualizations interactive.
The text blocks in your report are converted to text in your Medium story, and all plots, datasets, and files are automatically embedded.
Info
If you just need to embed a public report or plot directly into a Medium article, see the section on embedding. This section is for converting Datapane reports into Medium drafts.
1. Get a Medium Integration token
Go to Medium.com -> Settings, then scroll down to 'Integration tokens'. Type a name **** like 'Datapane' into the input box, then click 'Get integration token' to create a new, 65-character token.
2. Copy Medium integration token into your Datapane Profile
Copy this token and go to your Datapane settings page. Paste in the 'Medium token' input box, then hit 'Update'.
3. Share Report
When you navigate to an existing report and click 'Share Report', you'll now see an option to 'Create Medium Story'. Clicking on this will export the contents of your existing report to Medium as a draft (just make sure that your report visibility is set to 'Public'). You can edit the content further and publish on Medium once you're ready.
To embed a report into reddit, create a post with your report's main URL. If your report does not appear inline at first, click the Retry Thumb button to prompt Reddit to reload it.
In the post view, your report will be able to be used interactively.
Embed specific blocks
Learn how to embed subsets of your reports via queries.
Many times, your report will have different blocks, but you may wish to share only a subset, for instance it's often useful to embed a specific chart or dataset into another platform - especially if you are refreshing it on a cadence.
Instead of creating a report for each block, Datapane provides an block_name
query parameter you can add to your report link that allows you to query your report, so you can embed only the relevant blocks.
Here are a few of the most common examples and use-cases you will encounter.
Querying by Block name
The easiest way to embed only a single block is to assign a name
to your block when creating it, e.g. dp.Plot(plot, name="my-plot")
, and then add a query param to your embed URL as follows:
where ?block_name=my-plot
is a URL param that will extract any report block with the name
of my-plot
. Note that your block name cannot contain spaces.
For instance, the plot in this report has a name of block-7
, and so the following query will select just that plot: https://datapane.com/leo/reports/continent_covid_cases/?block_name=block-7
Info
These queries can be applied to embedded reports, e.g.
https://datapane.com/u/leo/reports/continent-covid-cases/embed/?block_name=block-7
Querying by Block type and index
As mentioned, Reports are comprised of multiple block types, such as Plot
, Table
, Text
, and so on - we can select just blocks of a specific type using XPath, and even select the specific index of a particular block type or a range.
Let's say there are both Table and Plot blocks in your report, and you want to only embed the plots from your report. Simply add /?blocksquery=//Plot
at the end of the report link. For example, to extract all the plots in this report you can use the following query,
https://datapane.com/u/leo/reports/google-trends/embed/?blocksquery=//Plot
If you want to query only the first plot of the report, just add an index to the Plot query, i.e., /?blocksquery=//Plot[1]
, e.g.
https://datapane.com/u/leo/reports/google-trends/embed/?blocksquery=//Plot[1] will select the first plot, and https://datapane.com/u/leo/reports/google-trends/embed/?blocksquery=//Plot[2] will the second.
Info
Querying by Block type will also remove all layout information from the report, making it easier to view when embedded