Skip to main content

CSV Functions

Functions for reading and writing CSV files.

ReadCsvFileAsString

Pure Reads an entire CSV file as a single string.

C++

FString ReadCsvFileAsString(const FString& FilePath, const FString& Delimiter = TEXT(","), bool bHasHeader = true)
ParameterTypeDefaultDescription
FilePathFString-Full path to the CSV file
DelimiterFString","Column delimiter character
bHasHeaderbooltrueWhether the first row is a header

Returns: The entire CSV content as a string

Category: EFM|Data|CSV

Blueprint Node

ƒRead Csv File As String
File Path
Delimiter
?
B Has Header
Return Value

ReadCsvFileAsMap

Pure Reads a CSV file into a key-value map.

C++

TMap<FString, FString> ReadCsvFileAsMap(const FString& FilePath, const FString& KeyColumn, const FString& Delimiter = TEXT(","))
ParameterTypeDescription
FilePathFStringFull path to the CSV file
KeyColumnFStringColumn name to use as map keys
DelimiterFStringColumn delimiter character

Returns: TMap<FString, FString> where keys are from the specified column and values are from the last column

Category: EFM|Data|CSV

Blueprint Node

ƒRead Csv File As Map
File Path
Key Column
Delimiter
?
Return Value

WriteCsvFile

Callable Writes rows to a CSV file.

C++

bool WriteCsvFile(const FString& FilePath, const TArray<FString>& Rows, const FString& Delimiter = TEXT(","))
ParameterTypeDescription
FilePathFStringFull path to the output CSV file
RowsTArray<FString>Each element is a row (columns separated by delimiter)
DelimiterFStringColumn delimiter character

Returns: true if the file was written successfully

Category: EFM|Data|CSV

Blueprint Node

ƒWrite Csv File
File Path
Rows
Delimiter
?
Return Value

Example

// Read CSV as string
CsvContent = ReadCsvFileAsString("C:/data/players.csv", ",", true)

// Read CSV as map (keyed by player name)
PlayerData = ReadCsvFileAsMap("C:/data/players.csv", "PlayerName", ",")

// Write CSV
Rows = [
"Name,Score,Level",
"Alice,1500,10",
"Bob,2300,15",
"Charlie,800,5"
]
WriteCsvFile("C:/data/output.csv", Rows, ",")