Is there a way to update and save data table from blueprint?

Hi, I found how we can use data table, but I also want to make update it and save it. For example I have a data table like below. [TABLE=“border: 1, cellpadding: 1, width: 500”]

Name
Color
width
Owner

Box_01
Blue
20
Adam

Box_02
Green
30
Ben

I can create a box with different color, width and owner. I want to update the data table and store it like… [TABLE=“border: 1, cellpadding: 1, width: 500”]

Name
Color
width
Owner

Box_01
Blue
20
Adam

Box_02
Green
30
Ben

Box_03
Pink
25
Rony

How can I do it?

DataTables are read-only data, they are not designed to be used as a database.
Last time I checked there’s no way to update a DataTable outside the UEditor, but has been a looong time since I’ve used them so not sure anymore.

Hi BrUnO XaVIeR, Thanks for the answer. Is there any other way where I can save the new box with with the new information along with the old boxes?

Saving an array of the structure you’re using for your Data Table in a Save Game can be an acceptable workaround depending on your needs.

Quote me if you want more information.

Yun-Kun, actually you are right. By the save game actually we can avoid it.

If data tables are still read-only, i’ve just wasted my day and possibly months ; )
I was so happy i’ve 100% understood how they work, how to setup different things in my project, easily and elegantly, with interactive tables updating, saving and loading for the player.
Save game would mean constant access to disk just for my step sequencer. I don’t know how to deal with arrays for now, and i’m going first check if structures are writable in game already.

Bottle in the sea.

](https://www.unrealengine.com/marketplace/usqlite-database)

https://i.pinimg.com/originals/3b/ba/44/3bba4469769abafe61059ecb959f79ed.png

https://www.unrealengine.com/marketplace/usqlite-database

2 Likes

I was planning to depress for a few weeks and loose half my weight, but you just resurrected me.

3 Likes

amazing, thank you

I was really hoping for a better answer here. Savegames are currently giving me issues where they can be loaded from but not saved to and not deleted which is very frustrating. No one else seems to have this issue and I’ve gotten no responses on any post I’ve made about them.

Is there another alternative?

Unfortunately this is still not a part of the engine proper, but I’ve added this functionality as a plugin:

https://forums.unrealengine.com/unreal-engine/marketplace/1677414-runtime-datatable-import-text-csv-or-google-sheet-at-runtime-and-fill-an-array-of-structs

It also has Google Sheets support so you can edit a Sheet and see your changes propagated to your game live during runtime. You can also use a text CSV on your local machine if you prefer so you can read and write using a local data table.

the engine now seems to support load/save to csv/json
this is available on 5.1 at least but not sure if it’s on previous too.

also
You can save your data table from cpp.
call
FDataTableEditorUtils::BroadcastPreChange(DataTable, FDataTableEditorUtils::EDataTableChangeInfo::RowList);

you can get the rows using DataTable->GetAllRows and you get some pointers.
you can modify them.
or you can add rows using DataTable->AddRow

at the end you need to call DataTable->Modify()
then
UEditorLoadingAndSavingUtils::SavePackages({DataTable->GetPackage()}, false);
then
FDataTableEditorUtils::BroadcastPostChange(DataTable, FDataTableEditorUtils::EDataTableChangeInfo::RowList);

credits goes to “Authaer” who told me this after some time of searching

2 Likes

Please edit clarify which version? (Im stuck in 4.27 - seeking solutions.) Ty.

it was specified on the next line.
i haven’t tried on 4.27 but would not be surprised if it’s not supported.
check the source code for 5.1 maybe you can backport it.