# Updating data in dash\_table

**URL:** <https://community.plotly.com/t/updating-data-in-dash-table/24879>\
**Category:** Dash Python\
**Created:** [June 21, 2019, 7:27am UTC](https://community.plotly.com/t/updating-data-in-dash-table/24879 "2019-06-21T07:27:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keend](https://avatars.discourse-cdn.com/v4/letter/k/f04885/32.png) [@keend](https://community.plotly.com/u/keend)\
**Post date:** [June 21, 2019, 7:27am UTC](https://community.plotly.com/t/updating-data-in-dash-table/24879/1 "2019-06-21T07:27:12Z")

</div>

Hi,

I was wondering what format is needed to update the data in a dash table.

For example

```
html.Div(
    dash_table.DataTable(
        id='file-table',
        columns=[{"name": p, "id": p} for p in params],
        style_cell={'textAlign': 'left'},
    )
)

```

One of the columns is Filename, and after a callback from uploading files I want to update the values belonging to column Filename.  
i’m doing something like this. Where df is a dataFrame that includes the filenames.

```
@app.callback(Output("file-table", "data"),
              [Input('upload-data', 'contents')],
              [State('upload-data', 'filename'),
               State('upload-data', 'last_modified')])
def update_output(list_of_contents, list_of_names, list_of_dates):
    return df.fileName.unique()

```

It does create the x amount of rows, but they are empty.

---

<div class="post-metadata">

**Author:** ![Blaceus](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/blaceus/32/2992_2.png) [@Blaceus](https://community.plotly.com/u/Blaceus)\
**Post date:** [June 21, 2019, 9:17am UTC](https://community.plotly.com/t/updating-data-in-dash-table/24879/2 "2019-06-21T09:17:58Z")

</div>

You need to include some kind of updating of `df` in your callback.

To me, it looks like `df` will be defined as you initiate your app and from there `df` will not change.  
You need to include your declaration of `df` inside your callback as well.

---

<div class="post-metadata">

**Author:** ![keend](https://avatars.discourse-cdn.com/v4/letter/k/f04885/32.png) [@keend](https://community.plotly.com/u/keend)\
**Post date:** [June 21, 2019, 9:56am UTC](https://community.plotly.com/t/updating-data-in-dash-table/24879/3 "2019-06-21T09:56:27Z")

</div>

I found the right way to return the data structure.

```
data = [{'Filename': f} for f in df.fileName.unique()]
return data
```
