#r "nuget: FSharp.Data"
type TP = FSharp.Data.CsvProvider< @"C:\Temp\multiline.csv", InferRows = 2>
multiline.csv:
f1,f2
"multi-
line field",2
Error:
Error: input.fsx (1,11)-(1,76) typecheck error The type provider "ProviderImplementation.CsvProvider" reported an error: Cannot read sample CSV from 'C:\Temp\multiline.csv': Couldn't parse row 1 according to schema: Expected 2 columns, got 1
In the sample, one row of data occupies two lines of the file. InferRows pre-truncates file lines, not data rows:
|
match maxNumberOfRows with |
|
| None -> reader.ReadToEnd() |
|
| Some max -> |
|
let sb = StringBuilder() |
|
let max = ref max |
|
while !max > 0 do |
|
let line = reader.ReadLine() |
|
if line = null then |
|
max := 0 |
|
else |
|
line |> sb.AppendLine |> ignore |
|
decr max |
|
sb.ToString() |
multiline.csv:
Error:
In the sample, one row of data occupies two lines of the file. InferRows pre-truncates file lines, not data rows:
FSharp.Data/src/CommonProviderImplementation/Helpers.fs
Lines 249 to 261 in d5287e4