I'm trying to convert excel files to dbf(dBASEIII) using python and my current process is:. Use xlrd to convert the excel file to a.csv. I take the headers off of the.csv and I use. Take the newly made.csv and use the dbf module to convert to dbf I remove the headers from the csv file and I run the following: table = dbf.fromcsv(origfname, filename='test.dbf', fieldnames=headers, dbftype='db3') As of now, when the process is over all the fields become memo fields, how do I make them into Char, Date, Number, etc. The fromcsv method is only intended to dump into Memo fields. If you want more control then you should skip the csv step and go from xls to dbf, using xlrd and dbf.
It will take a little more work: You'll have to create the table first with the appropriate fields, but then it's a simple matter of iterating through the xls table and writing to the dbf table. So something like this: sometable = Dbf.Table( 'whatever.dbf', 'name C(25); age N(3); history M', codepage='cp1252', ) # get data from xlrd (specifics are not correct, psuedo-code only). Data = for row in sheet: for cell in row: data.append(cell.value) # back to real code sometable.append(tuple(data)) # all data has been transferred sometable.close To automatically generate the field names and column types you would need to cycle through the first few rows of the spreadsheet to get the header names and value types. Here is an example data row I iterated through: u'PROD' u'cclark' 4.0 99.0 u'501302' u'244026' 1 42444.0 ' u'AB'.
Each row in your CSV or SQLite database effective represents a message correct. So -- you just need to break that up into individual files, 1 per row. Add those files a zip file. And you have exactly what you asked for (in an ugly format). The DB3 file will contain the database structure as well as all data records contained within. The Db3 file is used for storing and retrieving structured data using SQL. PalmDatabase.db3, is a common implementation of DB3, which stores personal information on the Palm Pre, including contacts, account information, and call logs.