Loading .csv at runtime Unreal4

Hello, the loading code should be correct. I think it might be the path.
Can you try these ones :

  • /Game/Blueprints/Data/NewData
  • /Game/Blueprints/Data/NewData.NewData
  • DataTable’/Game/Blueprints/Data/NewData’


Haaaaa ! I thought you import your csv as a DataTable in the editor before trying to load it. You won’t be able to load it like this indeed, whatever the path is. I think the LoadObject functions load only .uasset.
So 2 solutions :

  • create a datable then import csv into it
  • manually load the file. So use your own read file functions to load content, then you can create a raw DataTable (NewObject()) and use function “CreateTableFromCSVString(const FString& InString)” to parse your file and get your rows loaded (I never used the function but from the name, it should be ok)

Hey I’m working in unreal and I’m trying to import a .csv asset as a data table at run time. This is my function below and it works for assets that are already imported into unreal but not for new assets.

Imported Data Path = DataTable’/Game/Blueprints/Data/ImportedData.ImportedData’

It doesn’t work when I point it at the new file in the same folder it returns nothing

New Data Pathpath = DataTable’/Game/Blueprints/Data/NewData.csv’(or NewData.NewData)

I feel like I am missing a step, like defining the new files structure or the cast is failing because it isn’t a “UDataTable” yet. Any suggestions?

UDataTable * UUlyssesBPFunctions::LoadTableByPath(FName Path, bool& result)
result = false;

if (Path == NAME_None) return NULL;

UDataTable* LoadedTable = Cast<UDataTable>(StaticLoadObject(UDataTable::StaticClass(), NULL, *Path.ToString()));

return LoadedTable;