Bug in dash_table

Hi! I am working on a project where users will copy and paste inputs from an external source (like google sheets) to a dash_table. Some of these inputs need to include consecutive double quotes (ex.: a"“b), but when copied and pasted into the dash_table the consecutive double quotes become one double quote (ex.: a”"b becomes a"b). Does anybody know why this is happening or how I can prevent it?

Below is a trivial example which also exhibits this behavior:

from dash import Dash, dash_table, html

app = Dash(__name__)

app.layout = html.Div([
    dash_table.DataTable(
        id='table',
        columns=(
            [{'id': 'col1', 'name': 'col1'}]
        ),
        data=[{'col1':None}],
        editable=True,
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)

Thank you for your help!!

Hey @amymorrill, I don’t know what’s happening but maybe a work around would be to reformat the data after user input using a callback, like so:

from dash import Dash, dash_table, html, Output, Input, State

app = Dash(__name__)

app.layout = html.Div([
    dash_table.DataTable(
        id='table',
        columns=(
            [{'id': 'col1', 'name': 'col1'}]
        ),
        data=[{'col1':None}],
        editable=True,
    )
])

@app.callback(
    Output('table', 'data'),
    Input('table', 'data_timestamp'),
    State('table', 'data'))
def update_columns(timestamp, rows):
    for row in rows:
        try:
            row['col1'] = row['col1'].replace('"', '""')
        except:
            row['col1'] = row['col1']
    return rows

if __name__ == '__main__':
    app.run_server(debug=True)

However, it’s not ideal if some inputs have a single quote cause they’ll be replaced as well…
Good to note that this issue doesn’t occur with double single quotes ‘’.
Hope that helps.