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

AddTableView

  • Summary
  • Discussion
  • Syntax
  • Code Sample

Summary

Provides the ability to add a table to a data frame within a map document (.mxd).

Discussion

AddTableView provides a way to add a table into a map document. A reference to a TableView object must exist first. It can be a reference to a table in another map document by using the ListTableViews function, or it can be a reference to a table in a workspace by using the TableView function.

Syntax

AddTableView (data_frame, add_table)
ParameterExplanationData Type
data_frame

A reference to a DataFrame object within a map document.

DataFrame
add_table

A reference to a TableView object representing the table to be added. This reference can point to a table within an existing map document or it can reference a table in a workspace via the TableView function.

TableView

Code Sample

AddTableView example

The following script will add three tables from three different workspaces to a single data frame in a map document. The different workspaces are shapefile/dBASE, file geodatabase, and SDE.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "New Data Frame")[0]
dbf_Table = arcpy.mapping.TableView(r"C:\Project\Data\customers.dbf")
fGDB_Table = arcpy.mapping.TableView(r"C:\Project\Data\fGBD.gdb\customers")
SDE_Table = arcpy.mapping.TableView(r"C:\PathToSDEConnectionfile.sde\customers")
arcpy.mapping.AddTableView(df, dbf_Table)
arcpy.mapping.AddTableView(df, fGDB_Table)
arcpy.mapping.AddTableView(df, SDE_Table)
mxd.saveACopy(r"C:\Project\Project2.mxd")
del mxd
Feedback on this topic?

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
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal