Import CSV

External data can be imported into mXrap via a text file import using the Import CSV.


There are several major file types that can be imported, and they have specific documentation on these subpages:


The column definition needs to be configured correctly before import will be performed correctly.  Any error in any of the rows will result in none of the data being imported.  The user should therefore check the integrity of the data before import.  A typical example of such a problem is where a column defined as containing numbers contains a row where that value is not a number.

The CSV import must be configured to recognize each column as either an ID, Number, Date, Text or Location.

ID: Only one ID column is allowed for any one table. More than one ID will result in an error and data will not be imported.

Number: are any numbers

Date: This includes any consistent date format.  The Date format need to be specified in mXrap and any deviation in the data from this format will result in an error.

Text: allows any alphanumeric characters

Location: is a three component Vector of which the components are specified together.  This will require the three components to be consecutive columns in the table that is being imported.

Configuring a new Import CSV

  1. Select "Import CSVs" in the *New Module.
  2. Browse for and select the CSV file to be imported.
  3. Define each of the columns that should be imported by specifying a name for each column and the data type.  For Date/Time columns the date/time format needs to be specified. There are date format explanations available and can be seen by clicking the Date Format "?" button.
  4. Save the Import CSV configuration file.
  5. Any Error Messages occurred during CSV importation will be shown under Import Results tab. Imported data can be viewed under Results tab.

General layout of the CSV import.

Options also exist to:

  • Rename columns,
  • Delete columns,
  • Change the order of columns (Move Column Up and Move Column Down),
  • Reload file (Reloads the CSV file),
  • Saving/Rename/Apply options common to any tool.


A location (three columns) is imported by selecting the location option in the csv import tool. This information is then available to the user in two formats. Firstly, a single column containing all the information pertaining to the three columns (essentially a column of three component vectors) and secondly, three individual columns that holds individual numerical values. The three component location vectors is used for plotting in 3D, for example while the separated components can easily be used in filters.

Basic File Format Configuration

Basic file format configuration.

Decimal Mark

The decimal mark used in numbers can be specified in the CSV Format tab (eg, some people write Pi as 3.14159, others write 3,14159).


Treat Keywords as Null

Import CSV tool will automatically detect such words in csv file and record them as null in results.


Locale (language) for Dates

This option is designed for importing CSV files containing another language rather than English.

File Type

There are several specific file types available:

  1. Table of Columns: Delimited fields
    Use this for your standard CSV data files, where columns of data are listed in rows.  Microsoft Excel can export CSV files that can be read with this format.
    eg:
    Length, Width, Mass
    2, 3, 5
    10, 20, 30
    7.2, 100, 2.3
  2. Table of Columns: Fixed width fields
    Use this for data files which have columns of data listed in rows, but each column is exactly X characters wide.  An example of this format is IMS's EVP files.
    eg:
    Length  Width   Mass
        2      3      5
       10     20     30
      7.2    100    2.3
  3. Rows of named parameters: Delimited rows of Name, Value
    Use this for CSV files which have labels in the first column, and a value in the second column.  An example is a file of configuration settings and mine site parameters.
    eg:
    Minimum East, 2345
    Distance Atten, 1e-5
    Factor Multiplier, 4.5

Further options regarding the configuration of each type of file format can be found in the subtopics in this Help manual.


Tricks and Traps

A common pit-fall when importing CSV data is the error that can be associated with the format that has been specified not corresponding to the CSV data. Examples include text in a numbers column (this includes inequalities and "-" to represent null) and a mismatch in date formats.

It is advised that a table view in mXrap be set up to view the CSV that is being imported. If column values are "waiting" and not visible when they should be, it is likely that there is a consistency error in the formats.

  1. Troubleshooting should begin by changing the columns to "Text" in order to determine which column(s) are causing the issues.
  2. Check that the CSV Format is ok, i.e. Data starts on row X and other fields are correct (Fig. 2).
  3. For dates check that the formats match and for ID's and Number’s check that there is no text present in these columns.  
  4. Remember to "Reload File" in order for changes to be made to the original CSV.

mXrap will import blank cells as "null" and this can affect calculations if not accounted for.

There are date format explanations available and can be seen by clicking the Date Format "?".

Created with the Personal Edition of HelpNDoc: Easy EBook and documentation generator