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 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, 132nd 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 or delimiter character, as long as you specify that character 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.)

Latitude/Longitude and x, y, z coordinates

FME automatically recognizes some common attribute names as potential x,y,z coordinates and sets their types.

This data may not necessarily have a spatial component, but columns can be identified as x, y, or z coordinates to create point geometries. If a schema scan is performed and field labels contain variations of x/y, east/north, or easting/northing, FME will create the point geometry.

If FME detects latitude and longitude column names (for example, Latitude/Longitude or Lat/Long), column names are visible in the reader parameters Attribute Definition Table as x_coordinate, y_coordinate, and (if you have not already selected a coordinate system) the source coordinate system will be set to LL-WGS84.

Supported Coordinate Attributes

X and Y coordinate attributes are labeled using one of the well-known coordinate systems. If the X coordinate is found, the Y coordinate must also match. These well-known coordinate groups are:

Geographic Group – Longitude/Latitude (not case-sensitive):

  • (English/French/Swedish) lon, long, longitude and lat, latitude, latitud
  • (Dutch) Lengtegraad, Breedtegraad
  • (German) Laenge, Länge, Laengengrad, Längengrad in Östliche Längengrad (Östliche optional)
  • Breite, Breitengrad in Nördliche Breitengrad (Nördliche optional)
  • Japanese long and lat \U00005341\U00009032\U00007D4C\U00005EA6, \U00005341\U00009032\U00007DEF\U00005EA6

XYCoordinateGroup (not case-sensitive):

  • east(int), north(ing)
  • coord_x, coord_y
  • my_x_coord, my_y_coord
  • x, y
  • xCoord, yCoord
  • CoordX, CoordY
  • Japanese X and Y coordinates: x\U00005EA7\U00006A19, y\U00005EA7\U00006A19

z values do not have to match the X and Y grouping:

  • z, coord_z, z_coord, my_z_coord
  • height
  • elev, elevation
  • depth
  • zCoord zKoordinate
  • CoordZ KoordinateZ
  • zoord in Japanese z\U00005EA7\U00006A19
  • elevation/altitude in Japanese: \U00006A19\U00009AD8|\U00009AD8\U00005EA6

FME Knowledge Base

Search CSV