Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I convert a text file with point coordinates to database tables in the dBase (*.dbf) format in Python?

I am using ArcGIS Desktop.

share|improve this question

You can use Table to Table (Conversion) or Copy Rows (Data Management) here. Both of them have a very similar structure.

Usage of Table to Table:

This tool supports the following table formats as input:
    dBASE (.dbf)
    Comma Separate Value (.csv)
    tab delimited text (.txt)
    Microsoft Excel worksheets (.xls or .xlsx)
    OLE database
    personal, file, or SDE geodatabase
    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 input file 
contains spaces or special characters.


TableToTable_conversion (in_rows, out_path, out_name, {where_clause}, {field_mapping}, {config_keyword})


import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.TableToTable_conversion("inputFile.txt", "C:/output/Dbase.dbf", "outputFile")
share|improve this answer

As you're using ArcGIS, Aragon's answer should be sufficient. However, you can do it without ArcPy too. Python has a module for reading CSVs. You can then use dbfpy to write out the DBF. I believe there is a PyPi module for reading and writing to XLS, which might also serve.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.