Question

I'd like to create a type using the FSharp.Data.CsvProvider (v1.1.10) to process CSV files with a ";" separator and a predefined schema.

The following line reports an error:

type CsvType1 = CsvProvider<Sample="1;2;3", Separator=";", Schema="category (string), id (string), timestamp (string)">

The error is:

Specified argument is neither a file, nor well-formed CSV: Could not find file '...\1;2;3'.

Setting Sample to "", null or not setting it at all creates other errors.

Using a separator of "," and a sample of "1,2,3" works fine.. but that cannot read my csv files.

What am I doing wrong?

Était-ce utile?

La solution

This is a bug in FSharp.Data (fixed in 2.0.0-alpha3) which thinks 1;2;3 is a file and doesn't try to parse it as a CSV snippet, but you can use the following instead which will work:

CsvProvider<Sample="category (string); id (string); timestamp (string)", Separator=";">

Autres conseils

Looks like a bug in CSV provider: text parser doesn't support custom separators for sample texts.

, is not allowed in CSV file URIs and 1,2,3 is treated as a text sample correctly. ; is allowed and 1;2;3 is treated as a file name.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top