Last active
October 24, 2016 19:34
-
-
Save kalmanh/7261463 to your computer and use it in GitHub Desktop.
Ruby script to convert .mdb db file into .csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export data from Microsoft Access .mdb database into .csv files | |
# using https://github.com/brianb/mdbtools | |
# Install with homebrew - "brew install mdbtools" | |
class ConverterScript | |
tables = `mdb-tables -d , your_db_name.mdb`.chop.split(",") | |
tables.each do |table| | |
exists = system("mdb-export your_db_name.mdb '#{table}'") | |
`mdb-export your_db_name.mdb '#{table}' > #{table.gsub(" ", "_")}.csv` if exists | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment