Header menu logo FSharp.Data

CsvFile Type

Represents a CSV file. The lines are read on demand from reader. Columns are delimited by one of the chars passed by separators (defaults to just ,), and to escape the separator chars, the quote character will be used (defaults to "). If hasHeaders is true (the default), the first line read by reader will not be considered part of data. If ignoreErrors is true (the default is false), rows with a different number of columns from the header row (or the first row if headers are not present) will be ignored. The first skipRows lines will be skipped.

Instance members

Instance member Description

this.Append

Full Usage: this.Append

Parameters:
    rows : 'RowType seq

Returns: CsvFile<'RowType>

Returns a csv with the same rows as the original plus the provided rows appended

rows : 'RowType seq
Returns: CsvFile<'RowType>

this.Cache

Full Usage: this.Cache

Returns: CsvFile<'RowType>

Returns a new csv with the same rows as the original but which guarantees that each row will be only be read and parsed from the input at most once.

Returns: CsvFile<'RowType>

this.Filter

Full Usage: this.Filter

Parameters:
    predicate : Func<'RowType, bool>

Returns: CsvFile<'RowType>

Returns a new csv containing only the rows for which the given predicate returns "true".

predicate : Func<'RowType, bool>
Returns: CsvFile<'RowType>

this.GetColumnIndex

Full Usage: this.GetColumnIndex

Parameters:
    columnName : string

Returns: int

Returns the index of the column with the given name

columnName : string
Returns: int

this.Headers

Full Usage: this.Headers

Returns: string[] option

The names of the columns

Returns: string[] option

this.Map

Full Usage: this.Map

Parameters:
    mapping : Func<'RowType, 'RowType>

Returns: CsvFile<'RowType>

Returns a new csv where every row has been transformed by the provided mapping function.

mapping : Func<'RowType, 'RowType>
Returns: CsvFile<'RowType>

this.NumberOfColumns

Full Usage: this.NumberOfColumns

Returns: int

The number of columns

Returns: int

this.Quote

Full Usage: this.Quote

Returns: char

The quotation mark use for surrounding values containing separator chars

Returns: char

this.Rows

Full Usage: this.Rows

Returns: 'RowType seq

The rows with data

Returns: 'RowType seq

this.Save

Full Usage: this.Save

Parameters:
    path : string
    ?separator : char
    ?quote : char

Saves CSV to the specified file

path : string
?separator : char
?quote : char

this.Save

Full Usage: this.Save

Parameters:
    stream : Stream
    ?separator : char
    ?quote : char

Saves CSV to the specified stream

stream : Stream
?separator : char
?quote : char

this.Save

Full Usage: this.Save

Parameters:
    writer : TextWriter
    ?separator : char
    ?quote : char

Saves CSV to the specified writer

writer : TextWriter
?separator : char
?quote : char

this.SaveToString

Full Usage: this.SaveToString

Parameters:
    ?separator : char
    ?quote : char

Returns: string

Saves CSV to a string

?separator : char
?quote : char
Returns: string

this.Separators

Full Usage: this.Separators

Returns: string

The character(s) used as column separator(s)

Returns: string

this.Skip

Full Usage: this.Skip

Parameters:
    count : int

Returns: CsvFile<'RowType>

Returns a csv that skips N rows and then yields the remaining rows.

count : int
Returns: CsvFile<'RowType>

this.SkipWhile

Full Usage: this.SkipWhile

Parameters:
    predicate : Func<'RowType, bool>

Returns: CsvFile<'RowType>

Returns a csv that, when iterated, skips rows while the given predicate returns true, and then yields the remaining rows.

predicate : Func<'RowType, bool>
Returns: CsvFile<'RowType>

this.Take

Full Usage: this.Take

Parameters:
    count : int

Returns: CsvFile<'RowType>

Returns a new csv with only the first N rows of the underlying csv.

count : int
Returns: CsvFile<'RowType>

this.TakeWhile

Full Usage: this.TakeWhile

Parameters:
    predicate : Func<'RowType, bool>

Returns: CsvFile<'RowType>

Returns a csv that, when iterated, yields rowswhile the given predicate returns true, and then returns no further rows.

predicate : Func<'RowType, bool>
Returns: CsvFile<'RowType>

this.Truncate

Full Usage: this.Truncate

Parameters:
    count : int

Returns: CsvFile<'RowType>

Returns a csv that when enumerated returns at most N rows.

count : int
Returns: CsvFile<'RowType>

this.TryGetColumnIndex

Full Usage: this.TryGetColumnIndex

Parameters:
    columnName : string

Returns: int option

Returns the index of the column with the given name, or returns None if no column is found

columnName : string
Returns: int option

Static members

Static member Description

CsvFile.AsyncLoad(uri, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows, ?encoding)

Full Usage: CsvFile.AsyncLoad(uri, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows, ?encoding)

Parameters:
    uri : string
    ?separators : string
    ?quote : char
    ?hasHeaders : bool
    ?ignoreErrors : bool
    ?skipRows : int
    ?encoding : Encoding

Returns: Async<CsvFile>

Loads CSV from the specified uri asynchronously

uri : string
?separators : string
?quote : char
?hasHeaders : bool
?ignoreErrors : bool
?skipRows : int
?encoding : Encoding
Returns: Async<CsvFile>

CsvFile.Load(uri, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows, ?encoding)

Full Usage: CsvFile.Load(uri, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows, ?encoding)

Parameters:
    uri : string
    ?separators : string
    ?quote : char
    ?hasHeaders : bool
    ?ignoreErrors : bool
    ?skipRows : int
    ?encoding : Encoding

Returns: CsvFile

Loads CSV from the specified uri

uri : string
?separators : string
?quote : char
?hasHeaders : bool
?ignoreErrors : bool
?skipRows : int
?encoding : Encoding
Returns: CsvFile

CsvFile.Load(reader, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows)

Full Usage: CsvFile.Load(reader, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows)

Parameters:
    reader : TextReader
    ?separators : string
    ?quote : char
    ?hasHeaders : bool
    ?ignoreErrors : bool
    ?skipRows : int

Returns: CsvFile

Loads CSV from the specified reader

reader : TextReader
?separators : string
?quote : char
?hasHeaders : bool
?ignoreErrors : bool
?skipRows : int
Returns: CsvFile

CsvFile.Load(stream, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows)

Full Usage: CsvFile.Load(stream, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows)

Parameters:
    stream : Stream
    ?separators : string
    ?quote : char
    ?hasHeaders : bool
    ?ignoreErrors : bool
    ?skipRows : int

Returns: CsvFile

Loads CSV from the specified stream

stream : Stream
?separators : string
?quote : char
?hasHeaders : bool
?ignoreErrors : bool
?skipRows : int
Returns: CsvFile

CsvFile.Parse(text, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows)

Full Usage: CsvFile.Parse(text, ?separators, ?quote, ?hasHeaders, ?ignoreErrors, ?skipRows)

Parameters:
    text : string
    ?separators : string
    ?quote : char
    ?hasHeaders : bool
    ?ignoreErrors : bool
    ?skipRows : int

Returns: CsvFile

Parses the specified CSV content

text : string
?separators : string
?quote : char
?hasHeaders : bool
?ignoreErrors : bool
?skipRows : int
Returns: CsvFile

Type something to start searching.