Skip to content

Media, Attachments, and Embeds

Images and Media

The Media block allows you to include images, GIFs, video and audio in your reports. If the file is in a supported format, it will be displayed inline in your report. To include an image, you can use dp.Media and pass the path.


In the following example, Datapane will attempt to display images in your report for viewers and allow users to download them.

import datapane as dp

report = dp.Report(
    dp.Media(file="./image.png", name="Image1", caption="Datapane in action!"),

Attachments and Python objects

If you want to include static files like PDFs or Excel docs in your report, use the dp.Attachment block. You can also pass in a Python object directly. Once you upload the report, your users will be able to explore and download these attachments.

import datapane as dp

data_path = "./netflix_stock_data.csv"

vehicle_dict = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964

report = dp.Report(
  dp.Attachment(file = data_path),
  dp.Attachment(vehicle_dict, name='vehicle_dict')


The Embed block lets you embed content from other platforms e.g. Youtube, Spotify. This is how you'd use it:

import datapane as dp

report = dp.Report(

You don't need to use this block for simple embeds on TextReports like GIFs. For those, just use Markdown syntax i.e. ![](https://my-example-gif.gif)


If you're trying to embed an iframe, you can wrap it in an HTML block.

Text and HTML