Reputation:
Does anybody know what I could use to write a script to convert all MS Access .mdb
files in a directory to CSV files?
I'm working on Windows but have been using Cygwin for some work.
Upvotes: 1
Views: 1604
Reputation: 769
I presume you mean that you want to write each relevant table in every mdb file to a CSV file? Here is a possible structure for doing this.
Loop1 -- find all mdb files
Connect to access database
Loop2 -- loop round all the tables you are interested in
Wrie output to CSV file
End Loop2
End Loop1
You could look at the export facilities within MS Access and automate these using VBA. This works quite well except that the CSV files are sometimes messed up by white space e.g. carriage returns embedded within table fields.
If you are familiar with perl then this could be an answer.
Iterate over all mdb files using perl's File::Find module
Connect to ms-access database as described here (How do I connect to an MS Access database using Perl?)
Upvotes: 1
Reputation: 13727
I don't know of a script to do it, but a pretty easy way (unless you have a lot of MDB's) is to open up the MDB and save each table to CSV directly.
Upvotes: 0