Download

Import Multiple CSV Files into Unreal (same config/struct)

Hi All,

I want to import 9595 CSV files into unreal.

I do not want to do this manually, my past experience has been a struct needs to be selected for each CSV on import.

1: Is there a better way to get this information into unreal (Spline coordinates for spline creation, needs to be separated into 9595 blocks/groups/whatever)

2: How can I batch this? All CSV will be read by the same Struct.

Kindest regards,

Chris

You should make your own reader. I think one of the file i/o plugins (LowEntry i think) has a node that reads a folder. (sort and…) Loop through these files to load and parse them using first a parse string to array with the new-line character to get each line, then loop through all of these using another parse string to array node with a comma (or tab or whatever) as a delimiter, as per the csv file. Then you can pull out each chunk of text and manually put them into your struct which you can put into your struct array.

If you want to save this data so you don’t have to do this each time, you can run the whole thing in a construction script and make your final array instance editable. Then you can copy the data - in the main editor window, select the BP, right click on the exposed varable which should show all your data and copy it. You can then make a new variable of your struct and paste the data in.

Something like this.

There are many open source CSV C++ libraries, you can adapt them to the UE4 C++ as needed:

https://www.geeksforgeeks.org/csv-fi…ement-using-c/

Anyway the CSV format is quite simple so writing your own UE4 C++ code from scratch shouldn’t take a long time. But having many examples freely available can help if you adapt the code.

As answered here using C++ code with STL as external libraries directly still requires some work:

https://answers.unrealengine.com/que…brary-std.html

https://answers.unrealengine.com/que…tform-way.html

Hi Guys, Thanks for the replies.

Your saying I should load them at runtime from a folder? if so then very interesting… didn’t think about that.

or maybe you meant just run this once, copy the data and then populate the datatables?

At this point I just pull them in to a folder in the editor, select the struct on import (Each Time…) and then use them at runtime via another script to create my road splines and meshes.

Thanks for the different angles fellas, really appreciate your time.

Chris