z_csv_parser (zotonic_core v1.0.0-rc.10)

Parse CSV file into a nested list of lines and fields.

Link to this section Summary

Functions

Check if the first row is made up of column headers. The file must have at least a name and a category column.
Parse a line into its columns, using a character a separator.
Parse CSV data with the comma separator.
Parse CSV data with a certain separator.
Scan the file (or device) and return lines with fields.
Scan the file (or device) and return lines with fields.

Link to this section Types

-type line() :: [binary()].
-type lines() :: [line()].
-type sep() :: 44 | 59 | 9.

Link to this section Functions

Link to this function

cleanup_field(L)

Link to this function

inspect_data(B0)

-spec inspect_data(binary()) -> {ok, line(), sep()} | {error, invalid_csv_file}.
Check if the first row is made up of column headers. The file must have at least a name and a category column.
Link to this function

inspect_file(Filename)

-spec inspect_file(file:filename_all()) -> {ok, line(), sep()} | {error, invalid_csv_file | term()}.
Link to this function

parse_line(Line, Sep)

Parse a line into its columns, using a character a separator.
Link to this function

scan_data(Data)

-spec scan_data(binary()) -> lines().
Parse CSV data with the comma separator.
Link to this function

scan_data(Data, Sep)

-spec scan_data(binary(), sep()) -> lines().
Parse CSV data with a certain separator.
Link to this function

scan_lines(DeviceOrFilename)

-spec scan_lines(file:filename() | pid()) -> lines().
Scan the file (or device) and return lines with fields.
Link to this function

scan_lines(Filename, FieldSep)

-spec scan_lines(file:filename() | pid(), sep()) -> lines().
Scan the file (or device) and return lines with fields.