Xojo Developer Conference
Join us from 25th to 27th April 2018 in Denver.

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to read a CSV file correctly?
Feedback.

Answer: With all the rules for quotes and delimiters, you can simply use the SplitCommaSeparatedValuesMBS method in our plugins like this:
Example:
dim f as FolderItem = SpecialFolder.Desktop.Child("test.csv")
dim t as TextInputStream = f.OpenAsTextFile

while not t.EOF
dim s as string = t.ReadLine(encodings.ASCII)

dim items() as string = SplitCommaSeparatedValuesMBS(s, ";", """")

List.AddRow ""
dim u as Integer = UBound(items)
for i as Integer = 0 to u
List.Cell(List.LastIndex,i) = items(i)
next

wend
Notes: Please make sure you choose the right text encoding.




Links
MBS Xojo Plugins