Skip to content

Instantly share code, notes, and snippets.

@jovaneyck
Last active June 18, 2017 18:17
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 jovaneyck/dcb879cb509e986fbe498f0f3e28876e to your computer and use it in GitHub Desktop.
Save jovaneyck/dcb879cb509e986fbe498f0f3e28876e to your computer and use it in GitHub Desktop.
Read a CSV file with CsvProvider
#r @"..\packages\FSharp.Data\lib\net40\Fsharp.Data.dll"
open FSharp.Data
let [<Literal>] csvPath = ".\goodreads_library_export.csv"
type File = CsvProvider<csvPath>
let excel = new File()
excel.Rows
|> Seq.sortByDescending (fun book -> book.``Average Rating``)
|> Seq.take 10
|> Seq.map (fun book -> book.``Average Rating``, book.Title)
|> Seq.iter (printfn "%A")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment