Cfree
Cfree

Reputation: 57

Converting mdb files to csv

I have hundreds of .mdb files containing climate data and need an expedient and/or programmatic way of converting them to txt or csv files. I have tried a number of scripts, but having almost no programming experience, it's been difficult to debug them. I am attempting to use scripts using the TransferText method but I'm not getting it right. Can anyone point me in a general direction?

Upvotes: 2

Views: 10513

Answers (5)

John
John

Reputation: 4006

This can be done in Java. A complete example is provided here:

https://github.com/NACHC-CAD/access-to-csv-tool

AccessToCsvUtil provides most of the functionality a client would use directly and the integration tests provide examples of how to access the functionality (especially WriteToCsvIntegrationTest)

Upvotes: 0

Shawn Azdam
Shawn Azdam

Reputation: 6160

Using mdbtools (CLI) you can convert your MDB database to CSV:

1) Install mdbtools on Linux:

$ apt-get install mdbtools

or on Mac:

$ brew install mdbtools

2) Export your desired table to a CSV file:

$ mdb-export {databbase-name} {table-name}

Upvotes: 4

lborgav
lborgav

Reputation: 2391

I am doing the migration from a MDB database to MySQL doing some transformations and data validation on the way and the best tool for me right now is Pentaho Kettle (Community Edition). It's free and you can load the MDB database as input, browse the table, make transformations on the data and output as CSV, SQL, TXT, ...

Upvotes: 0

rojo
rojo

Reputation: 24466

Here's a Windows console program to convert mdb to csv. Using that you can use a simple for loop to convert all the mdb files in a directory to csv.

@echo off
setlocal
for %%I in (*.mdb) do (
    if not exist "%%~nI\" mkdir "%%~nI"
    MDBtoCSV.exe "%%I" "%%~nI\"
)

Upvotes: 2

Tom Collins
Tom Collins

Reputation: 4069

The best way to do this involves quite a bit of programming. I know you said you don't have much programming experience, so I'm not sure if you want to take the time to learn each step, or just hire someone else to do it. But here's the steps:

Create a new Access Database, and within that, create a new module for the code.
The code will do the following:

  • Search a directory for all .mdb files. If they are in multiple sub-folders, you'll have to do a recursive search through each folder and sub-folder.
  • With each file, you'll want to link the tables one at a time.
  • Then use the TransferText method to export it to a .csv file.
  • The delete that link and move to the next table.
  • Then move to the next .mdb file.

You can control which .mdb files, and which tables to export through filtering on the names, as well as where each .csv file is saved and it's name.

If you decide to hire out, a good programmer can have this built and ready to go for you in a few hours. If you decide to do this yourself, without much programming experience, expect it to take at least a few days and many more questions posted here. Sorry, wish I had easier advise for you. Good luck.

Upvotes: 2

Related Questions