Opening Files

Files are opened in XTabulator in the same way as any other application, with a few notable exceptions.

CSV & TAB Formats

The two most common tabular file formats are CSV ("comma-separated values") and TAB ("tab-separated values"). Let's ignore the fact that "CSV" is an acronym while "TAB" is the name of a character. So that opening files "just works", XTabulator expects files ending in .csv and .tab to follow the format each extension suggests.

CSV Format Expectations

CSV Document

XTabulator assumes .csv files to contain one record per line with fields separated by the comma character. Fields containing a comma must be surrounded by quotes (see "Quoted Fields" below).

TAB Format Expectations

TAB Document

XTabulator assumes .tab files to contain one record per line with fields separated by the tab character. Fields containing a tab must be surrounded by quotes (see "Quoted Fields" below).

Any Other File Type

When opening any other file type (such as .txt), even if the file is formatted as comma- or tab-separated, XTabulator makes no assumptions and will prompt you for the correct field separator ("delimiter").

Line Endings

Different operating systems, database software, and other applications can use a varying line endings. Some use a carriage return, some use a linefeed, and some use a carriage return followed by a linefeed. XTabulator automatically detects the line endings used in a file when opening. You can change the line endings before saving as well.

File Encoding

There are many languages (and thus many writing systems) in the world. Text files can be "encoded" for many of these languages. XTabulator automatically detects the file encoding when opening. You can change the file encoding before saving as well.

Quoted Fields

Consider the difference between the following records (assume it is CSV-formatted):

					John Doe,123 Elm Street,USA
				
					Doe, John,123 Elm Street,USA
				

The first example has three fields, whereas the second would be interpreted as having four. What if the surname and given name have to stay together in the record as "full name"? In this (contrived) example, the fields would have to appear as follows:

					"Doe, John",123 Elm Street,USA
				

When opening files, XTabulator correctly interprets "quoted fields", leaving the comma intact and the names together as one field, rather than splitting the field at the comma.

Headers

When opening, XTabulator makes no attempt to identify header rows. If a header row exists, you must instruct XTabulator to use the row as a header. You can also edit header titles individually.

How Errors Are Handled

By their nature, tabular files are loosely-structured and error-prone. In the quoted fields scenario above, if some records have fields containing unquoted commas and others don't, the number of fields will differ from row to row. Since XTabulator has no way of knowing how to correct this (ie, that "lastname, firstname" is common, so that's likely what happened in our example), this is treated as an error.

When opening files, XTabulator tries to interpret the file based on the hints it's given (the file extension, or with the separator character you specified). During this process, the application keeps track of the number of fields. If even one record has a different number of fields, XTabulator stops trying to open the file and notifies you not only that there is a problem, but it will even tell you the line on which the problem was detected. This gives you the chance to find the formatting error with a standard text editor and either correct it there or re-export the data with different settings.