Export Table (Conversion)

Summary

Exports the rows of a table or table view to a table.

Usage

  • The tool copies the rows of a table, table view, feature class, feature layer, delimited file, or raster with an attribute table to a new geodatabase or dBASE table or a delimited file.

  • This tool supports the following table formats as input:

    • Geodatabase
    • dBASE (.dbf)
    • Microsoft Excel worksheets (.xls and .xlsx)
    • Memory-based tables
    • Delimited files
      • Comma-delimited files (.csv, .txt, and .asc)
      • Tab-delimited files (.tsv and .tab)
      • Pipe-delimited files (.psv)

    For delimited files, the first row of the input file is used as the field names on the output table. Field names cannot contain spaces or special characters (such as $ or *), and an error will occur if the first row of the input file contains spaces or special characters.

  • The tool can be used to output a delimited file by adding one of the following file extensions to the output name in a folder workspace:

    • Comma-delimited files (.csv, .txt, or .asc)
    • Tab-delimited files (.tsv or .tab)
    • Pipe-delimited files (.psv)

  • If the output is not in a geodatabase, BLOB or raster fields will not be included. GlobalID fields will be converted to text fields.

  • To manage the fields in the output dataset and the contents of those fields, use the Field Map parameter.

    • To change the field order, select a field name and drag it to the new position.
    • The default data type of an output field is the same as the data type of the first input field (of that name) it encounters. You can manually change the data type at any time to any other valid data type.
    • The available merge rules are first, last, join, sum, mean, median, mode, minimum, maximum, standard deviation, and count.
    • When using the Join merge rule, you can specify a delimiter such as a space, comma, period, dash, and so on. To use a space, ensure that the pointer is at the start of the input box and press the Spacebar once.
    • You can specify the start and end positions of text fields using the format option.
    • Do not perform standard deviation on a single input because values cannot be divided by zero, so standard deviation is not a valid option for single inputs.

    Learn more about mapping fields in scripts

  • An SQL expression can be used to select a subset of features. For more information about the syntax for the Expression parameter, see SQL reference for query expressions used in ArcGIS.

  • Rows can be reordered in ascending or descending order by specifying the Sort Field parameter value. If more than one field is specified, rows will be sorted by the first field, and within that order, by the second field, and so on.

  • When converting geodatabase data that has subtypes or domains, both the subtype and domain codes and descriptions can be included in the output. Use the Transfer field domain descriptions environment to control this behavior. By default, only domain and subtype codes will be included in the output, not descriptions.

    Note:

    Conversion to a dBASE table with subtype and domain descriptions may take more time (slower performance) than without descriptions. If subtype and domain descriptions are not required in the output, it is recommended that you use the default setting (unchecked) for the Transfer field domain descriptions environment for best performance.

Parameters

LabelExplanationData Type
Input Table

The input table containing the rows to be exported to a new table.

Table View; Raster Layer
Output Table

The output table containing the exported rows.

Table
Expression
(Optional)

An SQL expression used to select a subset of records.

SQL Expression
Use Field Alias as Name

Specifies whether the input's field names or field aliases will be used as the output field name.

  • Unchecked—The input's field names will be used as the output field names. This is the default.
  • Checked—The input's field aliases will be used as the output field names.
Boolean
Field Map
(Optional)

The attribute fields that will be in the output with the corresponding field properties and source fields. By default, all fields from the inputs will be included.

Fields can be added, deleted, renamed, and reordered, and you can change their properties.

Merge rules allow you to specify how values from two or more input fields are merged or combined into a single output value. There are several merge rules you can use to determine how the output field will be populated with values.

  • First—Use the input fields' first value.
  • Last—Use the input fields' last value.
  • Join—Concatenate (join) the input field values.
  • Sum—Calculate the total of the input field values.
  • Mean—Calculate the mean (average) of the input field values.
  • Median—Calculate the median (middle) of the input field values.
  • Mode—Use the value with the highest frequency.
  • Min—Use the minimum value of all the input field values.
  • Max—Use the maximum value of all the input field values.
  • Standard deviation—Use the standard deviation classification method on all the input field values.
  • Count—Find the number of records included in the calculation.

Field Mappings
Sort Field
(Optional)

The field or fields whose values will be used to reorder the input records and the direction the records will be sorted.

  • Ascending—Records will be sorted from low value to high value.
  • Descending—Records will be sorted from high value to low value.

Value Table

arcpy.conversion.ExportTable(in_table, out_table, {where_clause}, use_field_alias_as_name, {field_mapping}, {sort_field})
NameExplanationData Type
in_table

The input table containing the rows to be exported to a new table.

Table View; Raster Layer
out_table

The output table containing the exported rows.

Table
where_clause
(Optional)

An SQL expression used to select a subset of records. For more information on SQL syntax see the help topic SQL reference for query expressions used in ArcGIS.

SQL Expression
use_field_alias_as_name

Specifies whether the input's field names or field aliases will be used as the output field name.

  • NOT_USE_ALIASThe input's field names will be used as the output field names. This is the default.
  • USE_ALIASThe input's field aliases will be used as the output field names.
Boolean
field_mapping
(Optional)

The attribute fields that will be in the output with the corresponding field properties and source fields. By default, all fields from the inputs will be included.

Fields can be added, deleted, renamed, and reordered, and you can change their properties.

Merge rules allow you to specify how values from two or more input fields are merged or combined into a single output value. There are several merge rules you can use to determine how the output field will be populated with values.

  • First—Use the input fields' first value.
  • Last—Use the input fields' last value.
  • Join—Concatenate (join) the input field values.
  • Sum—Calculate the total of the input field values.
  • Mean—Calculate the mean (average) of the input field values.
  • Median—Calculate the median (middle) of the input field values.
  • Mode—Use the value with the highest frequency.
  • Min—Use the minimum value of all the input field values.
  • Max—Use the maximum value of all the input field values.
  • Standard deviation—Use the standard deviation classification method on all the input field values.
  • Count—Find the number of records included in the calculation.

Field Mappings
sort_field
[sort_field,...]
(Optional)

The field or fields whose values will be used to reorder the input records and the direction the records will be sorted.

  • ASCENDING—Records will be sorted from low value to high value.
  • DESCENDING—Records will be sorted from high value to low value.

Value Table

Code sample

ExportTable example 1 (Python window)

The following Python window script demonstrates how to use the ExportTable function in immediate mode.

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.ExportTable_conversion("vegtable.dbf", "C:/output/output.gdb/vegtable")
ExportTable example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the ExportTable function.

#  Description: Use TableToTable with an expression to create a subset
#  of the original table.
 
# Import system modules
import arcpy
 
# Set environment settings
arcpy.env.workspace = "C:/data"
 
# Set local variables
inTable = "vegtable.dbf"
outTable = "C:/output/output.gdb/estuarine.csv"

# Set the expression, with help from the AddFieldDelimiters function, to select 
# the appropriate field delimiters for the data type
expression = arcpy.AddFieldDelimiters(arcpy.env.workspace, "VEG_TYPE") + " = 'Estuarine'"
 
# Execute TableToTable
arcpy.ExportTable_conversion(inTable, outTable, expression, "NOT_USE_ALIAS", 
                             None, None)

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics