0
Answered

Help parsing CSV file

Alessandro 1 year ago updated 1 year ago 2

I've been failing for days to successfully import a CSV file, so here I am begging for community help...

What I'm trying to do:

Add/Edit text in a CSV file, split each line to a different index of a list, populate some text boxes using just the index reference.

My Bolt Machine:

The "separator" variable: (I used "|" in the textile to indicate a new line)


And here is the odd result:


It almost works, but it add an extra empty line before each line apart from the first.

So I assume I'm really close, anyone can tell me how to remove those additional empty lines?
For reference, here's also the CSV file.
CSV file
Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Answered

Hey Alessandro!

So what's happening is correct behaviour: because your separator is the | character, each entry is what's between two |s, which includes the newline right after the separator on each line!

An easy solution would be to add String: Trim right after your To String unit, which will get rid of all whitespace on either side on the item.

Thanks! I knew I was close, I just needed an extra bit!!!