# Can I write to a Data Table?

**URL:** <https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630>\
**Category:** Community & Industry Discussion\
**Tags:** data, datatable, unreal-engine, question\
**Created:** [July 24, 2020, 8:45pm UTC](https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630 "2020-07-24T20:45:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![VagrantProfile](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@VagrantProfile](https://forums.unrealengine.com/u/VagrantProfile)\
**Post date:** [July 24, 2020, 8:45pm UTC](https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630/1 "2020-07-24T20:45:08Z")

</div>

I can READ data from a Data Table…is it possible for me to WRITE to a Data Table?

For example, I have a character roster (with the name of each character). I’d LIKE to give the user the ability to customize the name of a character using an Editable Text Box widget (and submitting it) within a widget blueprint.

However, I can’t figure out how to update an existing data table to accept this edit as the new name.

Any help here?

---

<div class="post-metadata">

**Author:** ![Marcis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/marcis/32/1103070_2.png) [@Marcis](https://forums.unrealengine.com/u/Marcis)\
**Post date:** [July 25, 2020, 11:47am UTC](https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630/2 "2020-07-25T11:47:51Z")

</div>

As far as I know you can not modify data table at runtime.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [July 25, 2020, 3:03pm UTC](https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630/3 "2020-07-25T15:03:23Z")

</div>

As MMMarcis said - no. In blueprints Data Tables are meant to be static.

But the data table is little more than a map full of structs with a _glorious_ interface 😉 Look into [saving game objects](https://docs.unrealengine.com/en-US/Gameplay/SaveGame/index.html); you can save / load the same structs that the DTs are using.

---

<div class="post-metadata">

**Author:** ![Teyrham](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teyrham](https://forums.unrealengine.com/u/Teyrham)\
**Post date:** [April 8, 2021, 3:52pm UTC](https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630/4 "2021-04-08T15:52:55Z")

</div>

Though you cannot do it from a basic version of unreal there are plugins that allow you to update the data table at runtime by saving to/ reading from a csv.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5ebdf999](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5ebdf999](https://forums.unrealengine.com/u/anonymous_user_5ebdf999)\
**Post date:** [April 9, 2021, 4:22pm UTC](https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630/6 "2021-04-09T16:22:15Z")

</div>

A data table is for storing info for the editor to use.

If you want to change variables on the fly though you should have it run of structures that all get updated when ever 1 is changed.

For example have a data table set up with all the beginning stats then at “begin play” have an array of structures set using the data table and then have that array updated anytime a player makes a change,

 ![335407-structure-library.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/7/f/67fbd3bef7ed802fb8ba3da0a5dfc8aeb04ac755.png)

Remember a data table is really just an array of structures

---

<div class="post-metadata">

**Author:** ![ullmatta](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ullmatta/32/491477_2.png) [@ullmatta](https://forums.unrealengine.com/u/ullmatta)\
**Post date:** [November 27, 2023, 9:43pm UTC](https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630/7 "2023-11-27T21:43:45Z")

</div>

Awesome! this kinda worked for me, I don’t get how the second part is working, but nevermind: I was missing the functionality of accessing the data by row name, so a tip to get that working: Save the array “OutRowNames”, then for access, use “find” → get index of row name → use that to get the correct index from “PlayerInfos”

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/3/2/3322be1e6fd4095dab99deda95589c76839d902d.png)

---

<div class="post-metadata">

**Author:** ![MaselinoM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MaselinoM](https://forums.unrealengine.com/u/MaselinoM)\
**Post date:** [April 25, 2024, 3:54pm UTC](https://forums.unrealengine.com/t/can-i-write-to-a-data-table/468630/8 "2024-04-25T15:54:44Z")

</div>

For everyone looking to write to a Data Table during editor time:

```auto
FDataTableEditorUtils::AddRow(UDataTable* DataTable, FName RowName)

```

shows what you need to do. The important lines are:

```auto
FDataTableEditorUtils::BroadcastPreChange(DataTable, EDataTableChangeInfo::RowList);
DataTable->Modify();

// Do your DataTable.AddRow(RowName, SomeNewRow);

FDataTableEditorUtils::BroadcastPostChange(DataTable, EDataTableChangeInfo::RowList);

```
