Table To Geodatabase (Conversion)

Summary

Converts one or more tables to geodatabase tables in an output geodatabase.

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 table.

  • 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)

  • The name of the output geodatabase tables will be based on the name of the input table. To control the output name and for additional conversion options, use the Table To Table tool.

  • The Copy Rows and Table To Table tools can also be used to convert a table to a geodatabase table.

  • If the name of an output table already exists in the output geodatabase, and the Allow geoprocessing tools to overwrite existing datasets option is unchecked, a number will be appended to the end of the name to make it unique (for example, OutputTable_1). If any of the input tables have the same name, a number will also be appended to the output table names, regardless of the overwrite existing datasets option. Otherwise, the table will be overwritten.

  • To transfer domains, subtypes, attribute rules, field groups, and contingent values to the output geodatabase, check the Transfer Geodatabase Field Properties environment.

Parameters

LabelExplanationData Type
Input Table

The list of tables that will be converted to geodatabase tables. Input tables can be INFO, dBASE, OLE DB, geodatabase tables, or table views.

Table View
Output Geodatabase

The destination geodatabase where the tables will be placed.

Workspace

Derived Output

LabelExplanationData Type
Updated Geodatabase

The geodatabase containing the new tables.

Workspace

arcpy.conversion.TableToGeodatabase(Input_Table, Output_Geodatabase)
NameExplanationData Type
Input_Table
[Input_Table,...]

The list of tables that will be converted to geodatabase tables. Input tables can be INFO, dBASE, OLE DB, geodatabase tables, or table views.

Table View
Output_Geodatabase

The destination geodatabase where the tables will be placed.

Workspace

Derived Output

NameExplanationData Type
Derived_Geodatabase

The geodatabase containing the new tables.

Workspace

Code sample

TableToGeodatabase example 1 (Python window)

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

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.conversion.TableToGeodatabase(["accident.dbf", "vegtable.dbf"], 
                                    "C:/output/output.gdb")
TableToGeodatabase example 2 (stand-alone script)

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

# Name: TableToGeodatabase_Example2.py
# Description: Use TableToDBASE to copy tables to geodatabase format
 
# Import system modules
import arcpy
 
# Set environment settings
arcpy.env.workspace = "C:/data"

# Make list of all tables in workspace
# The list of tables should be similar to this: 
#  ["accident.dbf", "vegtable.dbf"]
tables = arcpy.ListTables()

# Set local variables
outLocation = "C:/output/output.gdb"

# Run TableToGeodatabase
print(f"Importing tables to gdb: {outLocation}")
arcpy.conversion.TableToGeodatabase(tables, outLocation)

Licensing information

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

Related topics