# How can I create a datatable Uasset with Python ?

**URL:** <https://forums.unrealengine.com/t/how-can-i-create-a-datatable-uasset-with-python/1692747>\
**Category:** Programming & Scripting\
**Tags:** Python, datatable, unreal-engine, question\
**Created:** [February 16, 2024, 2:18pm UTC](https://forums.unrealengine.com/t/how-can-i-create-a-datatable-uasset-with-python/1692747 "2024-02-16T14:18:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![IDM25Design](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IDM25Design](https://forums.unrealengine.com/u/IDM25Design)\
**Post date:** [February 16, 2024, 2:18pm UTC](https://forums.unrealengine.com/t/how-can-i-create-a-datatable-uasset-with-python/1692747/1 "2024-02-16T14:18:31Z")

</div>

Hi, I need to create a datatable through a python script that is to be launched at the project startup. However the `DataTableFactory` object I’m using doesn’t want to create the datatable I’m asking. I’ve checked everything, the structure `S_CarStructure` is correctly loaded into `dt_factory.struct`, but the `script_factory_create_file` is returning False and I’m oblivious to why.

```auto
ait = unreal.AssetImportTask()
ait.filename = "J:/dt_creation/dest.csv"
ait.destination_path = '/Game'
ait.automated = True
ait.save = True
dt_factory = unreal.DataTableFactory()
dt_factory.struct = unreal.load_asset("/Game/S_CarStructure")
print(dt_factory.script_factory_create_file(ait))

```

I’ve been trying to search online for answers for ages but still haven’t found a solution. Any help would be much appreciated !

Thanks.

---

<div class="post-metadata">

**Author:** ![CokeKnight1990](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CokeKnight1990](https://forums.unrealengine.com/u/CokeKnight1990)\
**Post date:** [September 3, 2025, 4:29am UTC](https://forums.unrealengine.com/t/how-can-i-create-a-datatable-uasset-with-python/1692747/2 "2025-09-03T04:29:32Z")

</div>

Not sure if you are still looking for the answer, but I’m fiddling with this problem and find a solution.

The following python code works for me in Unreal 5.6.

```python
asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
row_struct = unreal.load_object(None, f"/Script/{module_name}.{struct_name}")
factory = unreal.DataTableFactory()
factory.struct = row_struct
data_table = asset_tools.create_asset(dt_name, datatable_dest_dir, unreal.DataTable, factory)

```
