Skip To Content

Copy Rows


Writes the rows from an input table, table view, feature class, or feature layer to a new table, including a comma delimited .txt file. If a selection is defined on a feature class or feature layer, only the selected rows are copied out.


  • All rows are copied if the input is a feature class or table. If the input rows are from a layer or table view that has a selection, only the selected features or rows are used.

  • If the input rows are a feature class, only the attributes, and not the geometry, are copied to the output table.

  • This tool supports the following table formats as input:

    • Geodatabase
    • dBASE (.dbf)
    • Comma-separated values (.csv or .txt)
    • Microsoft Excel worksheets (.xls or .xlsx)
    • INFO
    • VPF
    • OLE database
    • 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.

  • To add or append the copied rows to an existing table, use the Append tool.

  • The output table can be saved in a dBASE, geodatabase, or comma delimited .csv or .txt file.


CopyRows_management (in_rows, out_table, {config_keyword})
ParameterExplanationData Type

The rows from a feature class, layer, table, or table view to be copied.

Table View; Raster Layer

The table to which the rows will be written. The output table can be saved in a geodatabase, dBASE, or comma delimited file. To save to a dBASE table, specify a name with the extension .dbf. To save to a comma delimited file, specify a name with the extension .txt.


The config keyword specifies the default storage parameters for an enterprise geodatabase.


Code sample

CopyRows example 1 (Python window)

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

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

The following stand-alone script demonstrates how to use CopyRows to copy the tables in a folder to a file geodatabase.

# Name:
# Description: Convert all dBASE tables in a folder to geodatabase tables
# Requirement: os module

# Import system modules
import arcpy
import os
# Set environment settings
arcpy.env.workspace = "C:/data"
# Set local variables
outWorkspace = "c:/output/output.gdb"
# Use ListTables to generate a list of dBASE tables in the
#  workspace shown above.
tableList = arcpy.ListTables()
# Execute CopyRows for each input table
for dbaseTable in tableList:
    # Determine the new output feature class path and name
    outTable = os.path.join(outWorkspace, dbaseTable.strip(".dbf"))
    arcpy.CopyRows_management(dbaseTable, outTable)

Licensing information

  • ArcGIS Desktop Basic: Yes
  • ArcGIS Desktop Standard: Yes
  • ArcGIS Desktop Advanced: Yes

Related topics