merge multiple tables with Merge_management?

6915
11
08-23-2011 11:58 AM
leewalston
New Contributor
Hello,

Can anyone tell me how to merge multiple dbf tables from the same folder into one large dbf table?  Let's say I have 5 dbf tables with identical schema in the following folder:  "C:\\Data\\Tables".  I've tried listing the tables and using that object as the input, but to no avail. I haven't found much help on other forums as well...

This sounds so simple, but for some reason I can't figure it out:

gp.workspace = "C:\\Data\\Tables"
tablelist = gp.ListTables("*")
gp.Merge_management(tablelist, "C:\\Data\\Tables\\merged.dbf")

Thanks for any input.
Tags (2)
0 Kudos
11 Replies
MatthiasAbele
New Contributor II
No idea...now it is working, but thanx!

Matthias
0 Kudos
leewalston
New Contributor
You can do it in Arc10:

import arcpy, os
arcpy.env.workspace = "c:/junk"
tableList = arcpy.ListTables()
arcpy.Merge_management(tableList, "easy.dbf")
In 9.x, it's much more involved.

What version of Arc are you using?


Thanks!  The code you provided worked.  I swear that at one time I tried that very same piece of code and I got an error. Sometimes you just need to step away for a while or get a fresh pair of eyes on it. Thanks again.  ..... oh, and I'm using 10.0.
0 Kudos