ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Copy Rows

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Writes the rows from an input table, table view, feature class, or feature layer to a new table. If a selection is defined on a feature class or feature layer in ArcMap, only the selected rows are copied out.

Usage

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

  • If the input rows are a feature class, then 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)
    • Tab-delimited text (.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.

    Learn more about table formats supported in ArcGIS

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

  • The output table can be saved in a dBASE, ArcSDE geodatabase, file geodatabase, or personal geodatabase, or as an INFO table.

  • If the output is an INFO table, neither the output path nor the table name can have spaces.

Syntax

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

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

Table View ; Raster Layer
out_table

The table to which the rows will be written. The output table can be saved in a dBASE, ArcSDE geodatabase, file geodatabase, or personal geodatabase, or as an INFO table.

The table to which the rows will be written. The output table can be saved in a dBASE, ArcSDE geodatabase, file geodatabase, or personal geodatabase, or as an INFO table.

Table
config_keyword
(Optional)

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

String

Code sample

CopyRows example 1 (Python window)

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

import arcpy
from arcpy import env

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: CopyRows_Example2.py
# Description: Convert all dBASE tables in a folder to geodatabase tables
# Requirement: os module

 
# Import system modules
import arcpy
from arcpy import env
import os
 
# Set environment settings
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)

Environments

  • Current Workspace
  • Output CONFIG Keyword
  • Scratch Workspace

Licensing information

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

Related topics

  • An overview of the Table toolset

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal