plotly / plotly/dash

markdown text is not parsed while exporting data in dash table

Open
#2,644 7 comments 0 reactions 1 assignee View on GitHub

@pioneerHitesh is already working on this.

Since Oct 26, 2023.

bug dash-data-table P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

General Description :
I am experiencing an issue with the Dash DataTable component when exporting data in CSV format. The problem is that Markdown-formatted text is not being properly parsed during export, and I would like to request a fix for this issue.

  • dash dependancies and versions
dash                 2.8.1
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-renderer        1.9.1
dash-table           5.0.0

Describe the bug

I have created a DataTable with a column containing Markdown-formatted text that includes hyperlinks. When I export the data to CSV using the built-in export feature, the Markdown is not parsed, and the raw Markdown text is exported instead.

Here's the code I'm using:

data = [
    {'column1': 'Text 1', 'column2': '[Link 1](https://example.com)'},
    {'column1': 'Text 2', 'column2': '[Link 2](https://example.org)'},
]

app.layout = html.Div([
    dash_table.DataTable(
        id='datatable',
        columns=[
            {'name': 'Column 1', 'id': 'column1'},
            {'name': 'Column 2', 'id': 'column2', 'type': 'text', 'presentation': 'markdown'},
        ],
        data=data,
        style_data_conditional=[
            {
                'if': {'column_id': 'column2'},
                'textAlign': 'left',
            },
        ],
        style_table={'overflowX': 'auto'},
        style_cell={'textAlign': 'left'},
        export_format="csv",
    ),
])

Actual Behavior:
When I export the data to CSV, the Markdown in Column 2 is not parsed, and the raw Markdown text, including the hyperlinks, is exported.

Expected Behavior:
I would like the Markdown to be properly parsed during export, and only the text (excluding the Markdown syntax) should be exported. This would result in CSV data that looks like the following:

Screenshots
Current UI Display::
image

Current Exported CSV Content:
image

Expected (Requested) CSV Content:
image

Additional Information:
I believe that fixing this issue would improve the usability of Dash DataTable's export functionality, especially when Markdown is used for text formatting. Thank you for your attention to this matter, and I hope to see a resolution soon.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.