Skip to content

Instantly share code, notes, and snippets.

@peheje
Last active September 10, 2022 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peheje/01771f6e0f7dbf8a1e231269283fd870 to your computer and use it in GitHub Desktop.
Save peheje/01771f6e0f7dbf8a1e231269283fd870 to your computer and use it in GitHub Desktop.
Simple CSV reader F#
open Microsoft.VisualBasic.FileIO
let read (path: string) =
let rec loop (parser: TextFieldParser) output =
if parser.EndOfData then output |> List.rev
else loop parser ((parser.ReadFields()) :: output)
let parser = new TextFieldParser(path, Delimiters = [|","|], HasFieldsEnclosedInQuotes = true)
loop parser []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment