Reimport DataTable(csv) with python

I’m doing something similar, but with JSON instead of CSV, but it works pretty much the same.
Just make sure to first load the assets from the content browser, then you’ll be able to write it.

Here is the code I’m using to update a DataTable from a JSON file on disk using a Struct already available in the content browser

# Load DataTable and Struct assets
data_table = unreal.EditorAssetLibrary.load_asset(ue_asset_path)
data_structure = unreal.EditorAssetLibrary.load_asset(datastructure_source_path + datastructures)

# Fill in data from json file, and save DataTable asset 
unreal.DataTableFunctionLibrary.fill_data_table_from_json_file(data_table, json_file_path, data_structure)
unreal.EditorAssetLibrary.save_loaded_asset(data_table, True)

I’m not sure if having the Struct made in C++ makes any difference in term of how you can access it through python.

Hope this helps

1 Like