unreal.DataTable

class unreal.DataTable(outer: Object | None = None, name: Name | str = 'None')

Bases: Object

Imported spreadsheet table.

C++ Source:

  • Module: Engine

  • File: DataTable.h

Editor Properties: (see get_editor_property/set_editor_property)

  • asset_import_data (AssetImportData): [Read-Only] The file this data table was imported from, may be empty

  • ignore_extra_fields (bool): [Read-Write] Set to true to ignore extra fields in the import data, if false it will warn about them

  • ignore_missing_fields (bool): [Read-Write] Set to true to ignore any fields that are expected but missing, if false it will warn about them

  • import_key_field (str): [Read-Write] Explicit field in import data to use as key. If this is empty it uses Name for JSON and the first field found for CSV

  • row_struct (ScriptStruct): [Read-Only] Structure to use for each row of the table, must inherit from FTableRowBase

  • strip_from_client_builds (bool): [Read-Write] Set to true to not cook this data table into client builds. Useful for sensitive tables that only servers should know about.

does_row_exist(row_name) bool

Returns whether or not Table contains a row named RowName

Parameters:

row_name (Name) –

Return type:

bool

export_to_csv_file(csv_file_path) bool

Export a Data Table to CSV file.

Parameters:

csv_file_path (str) – The file path of the CSV file to write (output file is UTF-8).

Returns:

True if the operation succeeds, check the log for errors if it didn’t succeed.

Return type:

bool

export_to_csv_string() str or None

Export a Data Table to CSV string.

Returns:

True if the operation succeeds, check the log for errors if it didn’t succeed.

out_csv_string (str): Output representing the contents of a CSV file.

Return type:

str or None

export_to_json_file(json_file_path) bool

Export a Data Table to JSON file.

Parameters:

json_file_path (str) – The file path of the JSON file to write (output file is UTF-8).

Returns:

True if the operation succeeds, check the log for errors if it didn’t succeed.

Return type:

bool

export_to_json_string() str or None

Export a Data Table to JSON string.

Returns:

True if the operation succeeds, check the log for errors if it didn’t succeed.

out_json_string (str): Output representing the contents of a JSON file.

Return type:

str or None

fill_from_csv_file(csv_file_path, import_row_struct=None) bool

Empty and fill a Data Table from CSV file.

Parameters:
  • csv_file_path (str) – The file path of the CSV file.

  • import_row_struct (ScriptStruct) – Optional row struct to apply on import. If set will also force the import to run automated (no questions or dialogs).

Returns:

True if the operation succeeds, check the log for errors if it didn’t succeed.

Return type:

bool

fill_from_csv_string(csv_string, import_row_struct=None) bool

Empty and fill a Data Table from CSV string.

Parameters:
  • csv_string (str) – The Data that representing the contents of a CSV file.

  • import_row_struct (ScriptStruct) – Optional row struct to apply on import. If set will also force the import to run automated (no questions or dialogs).

Returns:

True if the operation succeeds, check the log for errors if it didn’t succeed.

Return type:

bool

fill_from_json_file(json_file_path, import_row_struct=None) bool

Empty and fill a Data Table from JSON file.

Parameters:
  • json_file_path (str) – The file path of the JSON file.

  • import_row_struct (ScriptStruct) – Optional row struct to apply on import. If set will also force the import to run automated (no questions or dialogs).

Returns:

True if the operation succeeds, check the log for errors if it didn’t succeed.

Return type:

bool

fill_from_json_string(json_string, import_row_struct=None) bool

Empty and fill a Data Table from JSON string.

Parameters:
  • json_string (str) – The Data that representing the contents of a JSON file.

  • import_row_struct (ScriptStruct) – Optional row struct to apply on import. If set will also force the import to run automated (no questions or dialogs).

Returns:

True if the operation succeeds, check the log for errors if it didn’t succeed.

Return type:

bool

get_column_as_string(property_name) Array[str]

Export from the DataTable all the row for one column. Export it as string. The row name is not included. see: GetDataTableColumnNames. see: GetDataTableColumnNameFromExportName.

Parameters:

property_name (Name) –

Return type:

Array[str]

get_column_export_names() Array[str]

Get the friendly export name of each column in this Data Table. see: GetDataTableColumnNameFromExportName.

Returns:

out_export_column_names (Array[str]):

Return type:

Array[str]

get_column_name_from_export_name(column_export_name) Name or None

Get the raw property name of a data table column from its friendly export name.

Parameters:

column_export_name (str) –

Returns:

True if a column was found for the friendly name, false otherwise.

out_column_name (Name):

Return type:

Name or None

get_column_names() Array[Name]

Get the name of each column in this Data Table. note: These are always the raw property names ( see: GetDataTableColumnAsString) rather than the friendly export name that would be used in a CSV/JSON export ( see: GetDataTableColumnNameFromExportName).

Returns:

out_column_names (Array[Name]):

Return type:

Array[Name]

get_row_names() Array[Name]

Get Data Table Row Names

Returns:

out_row_names (Array[Name]):

Return type:

Array[Name]

get_row_struct() ScriptStruct

Get the row struct used by the given Data Table, if any

Return type:

ScriptStruct