CSV (Comma-Separated Value) Reader/Writer
FME reads and writes files in CSV format.
CSV Product and System Requirements
|
Format |
Product |
Operating System |
||||
|---|---|---|---|---|---|---|
|
Reader/Writer |
FME Form |
FME Flow |
FME Flow Hosted |
Windows 64-bit |
Linux |
Mac |
|
Reader |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
|
Writer |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Overview
Comma-Separated Value, or CSV, is a way to store structured information in an ASCII file format, making it a very simple database. CSV is a popular format for exchanging information between spreadsheets, databases, and other software applications.
In FME, CSV is treated as a database format. Each line in the file is a record, with a comma (or other) character sequence between each field within the record.
There is often a header line to provide names for the fields. For example:
company, address, telephone, web
Safe Software Inc, Suite 1200 - 9639 137A Street Surrey BC, 604-501-9985, www.safe.com
Files do not have to be comma-separated: FME can recognize any file with any separator, as long as you specify that separator in the parameter settings.
CSV File Extensions
By convention, CSV files use the .csv extension, but the reader and writer can use any extension.
The CSV reader can read from a gzipped file with the extension .csv.gz, and the CSV writer can write a gzipped file if the extension of the destination file ends with .gz.
Reader Overview
The CSV reader produces an FME feature for each line in each of the CSV files inside the given folder. The CSV reader first scans the folder for all CSV files that are defined in the workspace.
The CSV reader can process only specified files; otherwise, it reads all files in a folder. Optionally, a single CSV file can be given in the workspace. In this case, only that CSV file is read.
The CSV reader can also read data consisting of fixed-width columns without a separator, if the character spacing the data (usually a space character) does not appear in the data itself. Use the parameter Skip Duplicate Delimiters. (An alternative method is to use the Text File Reader/Writer and AttributeSplitter transformer.)
For convenience, the CSV reader can be set to create point geometries by taking coordinate values from specified columns. When Create Point Geometry From Attributes is selected, users can specify the attributes to make into x, y, and optionally z coordinates. The reader parameters window will attempt to guess attribute names and if certain combinations are detected (for example, lat and long), the Coordinate System parameter will also be set (in this case, to LL-WGS84).
For more information, see Latitude/Longitude and x, y, z coordinates.