i've been let loose in the workplace to learn python to do things in Arcmap10. so, i've learning python as i go and trying to remember the programming i have done. where i am in this project is converting a dbf, or csv, xls in a simple fashion. from there, all the files will be copied together into one file. i've got the all-in-one xls working, but i can't find an easy, simple dbf to xls solution.
i condensed code found here: http://blog.gmane.org/gmane.comp.python.education/page=12
into:
from xlwt import Workbook
import dbfpy.dbf
input0 = '...file.dbf'
output = '...file.xls'
def test1():
dbf = dbfpy.dbf.Dbf(input0)
book = Workbook()
sheet1 = book.add_sheet('Sheet 1')
for row in range(len(dbf)):
for col in range(2):#chop to two for my purposes, gm
sheet1.row(row).write(col, dbf[row][col])
book.save(output)
test1()
this works, minus the lack of field names.
