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?

Was it helpful?

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=";">

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top