# To use a CSV file

• In the project directory
• Mine was in Documents/UnrealProjects/projectname/content.
• Make a data directory.
• Create a CSV file.
• You can do this with excl, or a text editor.
• The first row contains headers.
• Make sure these are good because you will use them later.
• The first column header should be a comma (,)
• All other columns should have a header.
• The first column should be a unique "key", I just used a serial number.
• Save this as something.csv
• Create a struct to hold the data in unreal
• In your blueprints directory make a structure
• Bluprints->structure
• Add a member for each column in the CSV file.
• Import the data
• Click the inport button in the content browser.
• Select the csv file from the pop-up menu.
• This will bring up an Data Table Options menu.
• Import this as a Data Table (default)
• Select your new structure to import
• (DS_NewLevelDesc in my case)
• And click ok.
• You can click on the new data table to see the values were imported properly.
• Open the level
• Open the level blueprint
• On the event begin play
• Add node Get Data Table Row Names
• Promote the input to a varable
• Select your new data table (Different name than above, sorry)
• Run the ouptut to a foreach loop, which will loop over the rows names (the unique keys in column 1 of the csv file) of the table.
• Use this get each row from the table.
• You can break the row into individual data fields and take an action on each field.
• Note at the bottom of the above graph, a random number is generated and compared to the chance field to determine if the item is placed. That will feed the branch in the next graph.
• Now based on the Type column, generate a new actor of that type.
• if (chance > rand()/RAND_MAX) {
if (type == "bat") {
MakeBat()
} else if (type == "health") {
MakeHealth()
}
} 
• Sorry, the next steps should really be cleaned up.
• The make health routne:
• Params was saved two steps back, and was a column in the CSV file.
• The MakeBat routine
• MakeBat() {
pos = params.find(';');
healthString = params.substr(0,pos);
bat.health = atoi(healtString)

damageString = params.substr(pos+1);
bas.damage = atoi(damageString);
} 
• Note I had to add a controller to the bat at the end.