Table to Table (Conversion)
Summary
Converts an input table to a dBASE or geodatabase table.
Usage
-
This tool supports the following table formats as input:
- dBASE (.dbf)
- Comma Separate Value (.csv)
- tab delimited text (.txt)
- Microsoft Excel worksheets (.xls or .xlsx)
- INFO
- VPF
- OLE database
- personal, file, or SDE geodatabase
- in-memory table views
For file input (.csv or .txt), 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 you will receive an error if the first row of the input file contains spaces or special characters.
-
This tool can convert input tables to dBASE (.dbf), geodatabase (personal, file, or SDE), or INFO tables.
This tool can be used to export an ArcGIS table to a dBASE table (.dbf) that can be read and edited in Microsoft Excel.
The Field Map parameter controls how the input fields in the Input Features will be written to the Output Features.
- To drop fields during the conversion, delete input fields from the Field Map. This will not affect the input feature class.
- A single output field can be generated from multiple input fields if a new field is created and the contents of the output field are generated from multiple (differently named) fields.
- The data type of an output field will default to the same as the data type of the first input field (of that name) it encounters. The data type may be changed manually at any time to any valid data type. All valid data types will be listed if the tool's dialog box is used.
- When using the Merge rule, you can specify your own delimiter such as a space, comma, period, dash, and so on. If you want to use a space, make sure your mouse pointer is at the start of the input box and click the space bar once.
- There are a number of Merge rules available: first, last, join, sum, mean, median, min, max, and standard deviation.
- Format options are only available on input fields of type text (and in conjunction with the Join merge rule). You can specify start point, end point, and so on. Format allows you to apply your changes to the selected input field or apply them to all occurrences of the same input field.
- Standard deviation should not be performed on a single input because values can't be divided by zero, so standard deviation is not a valid option for single inputs.
When converting geodatabase data that has subtypes or domains to a dBASE table, both the subtype and domain codes and descriptions can be included in the output. Use the Transfer field domain descriptions geoprocessing environment to control this behavior. By default, only domain and subtype codes will be included in the output, not descriptions.
Note:Conversion to dBASE (.dbf) table with subtype and domain descriptions may take more time (slower performance) than without descriptions. If you do not require the subtype and domain descriptions in your dBASE (.dbf) table output, it is recommended you use the unchecked (False or NOT_TRANSFER_DOMAINS in scripting) default behavior of the Transfer field domain descriptions environment to achieve best performance.
Syntax
Parameter | Explanation | Data Type |
in_rows |
The input table to be converted to a new table. | Table View; Raster Layer |
out_path |
The destination where the output table will be written. | Workspace |
out_name |
The name of the output table. If the Output Location is a folder, convert the Input Rows to a dBASE table by specifying a name with the extension .dbf, or convert the Input Rows to a INFO table by specifying a name with no extension. If the Output Location is a geodatabase, convert the Input Rows to a geodatabase table by specifying a name with no extension. | String |
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 |
field_mapping (Optional) |
The fields and field contents chosen from the input table. You can add, rename, or delete output fields as well as set properties such as data type and merge rule. | Field Mappings |
config_keyword (Optional) |
Specifies the default storage parameters (configurations) for geodatabases in a relational database management system (RDBMS). This setting is applicable only when using SDE geodatabase tables. ArcSDE configuration keywords are set by the database administrator. | String |
Code Sample
The following Python window script demonstrates how to use the TableToTable tool in immediate mode.
import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.TableToTable_conversion("vegtable.dbf", "C:/output/output.gdb", "vegtable")
The following stand-alone script demonstrates how to use the TableToTable tool.
# Name: TableToTable_Example2.py
# Description: Use TableToTable with an expression to create a subset
# of the original table.
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/data"
# Set local variables
inTable = "vegtable.dbf"
outLocation = "C:/output/output.gdb"
outTable = "estuarine"
# Set the expression, with help from the AddFieldDelimiters function to select the appropriate field delimiters for the data type
expression = arcpy.AddFieldDelimiters(env.workspace, "VEG_TYPE") + " = 'Estuarine'"
# Execute TableToTable
arcpy.TableToTable_conversion(inTable, outLocation, outTable, expression)