mdb-export not creating CSV file
Asked Answered
R

4

8

When I run mdb-export, the program dumps the comma delimited table to the terminal, but does not create a csv file as far as I can tell.

Is mdb-export creating a csv file somewhere or is this dump its intended function? If the latter is the case, how would one go about getting the output into a csv file?

Raw answered 22/8, 2013 at 1:46 Comment(0)
R
16

Alright, I ended up figuring it out. I was originally following the tutorial here and was running:

mdb-export database.mbd TABLE_NAME, but what I needed was

mdb-export database.mdb TABLE_NAME > output_file.csv

Raw answered 22/8, 2013 at 17:15 Comment(0)
W
22

You first need to install mdb-tools (Ubuntu, Debian):

sudo apt install mdbtools

Then to list the tables do this:

mdb-tables database.mbd 

then with the desired table

mdb-export database.mdb table > table.csv

To export all the tables try this command:

mdb-tables -1 database.mdb | xargs -I{} bash -c 'mdb-export database.mdb "$1" >"$1".csv' -- {}
Wynellwynn answered 8/10, 2018 at 19:51 Comment(4)
Equivalent from mac terminal to export all tables in different CSV files: mdb-tables database.mdb | xargs -n1 -I{} bash -c 'mdb-export database.mdb "$1" >"$1".csv' -- {}Teapot
getting error with big database read: Is a directory Couldn't read first page. Couldn't open database.Onofredo
@Onofredo sounds like a mdb-tools limitationWynellwynn
@EduardFlorinescu my file has more than 200+ tablesOnofredo
R
16

Alright, I ended up figuring it out. I was originally following the tutorial here and was running:

mdb-export database.mbd TABLE_NAME, but what I needed was

mdb-export database.mdb TABLE_NAME > output_file.csv

Raw answered 22/8, 2013 at 17:15 Comment(0)
S
2

I have one of the db with table name containing spaces, so from this worked where quotes need to be added around table name:

mdb-export Atlanta_All_Merchants..accdb 'table name with spaces' > output.csv
Saucer answered 28/6, 2018 at 22:7 Comment(0)
F
2

mdb-export only dumps the contents of the file onto the screen. You need to give the '>' output redirector to save the contents onto a file. Ex: mdb-export DATABASE TABLE_NM > extract.csv

Foundation answered 27/11, 2018 at 12:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.