just sample perl code that parses xlxs files and loads to mysql/mariadb.
Initial commit written in just a couple hours but will be adding to it.
If you are using a csv file, just open it in Excel and export as xlsx.
Dependancies:
DBI - perl db interface
DBD::mysql - mysql driver (should work on MariaDB as well)
SQL::Abstract - to dynamically assign placeholders; sanitize sql input without the need for static statement structures
Getopt::Long - to...get options
Spreadsheet::XLSX - for xlsx parsing and determining input data types
Text::Iconv - converter for xlsx data
List::MoreUtils - for iterating over array elements in chunks
Data::Dump::Streamer (to debug data structures)
Usage example:
init.pl --file F:\data_load.xlsx --database testdb --table testtable --user eparlin --pw pass --host 192.168.201.132 --port 3306
The host and port args are optional. If you are on localhost you can omit them
TODO:
Add support/drivers for Postgres, SQLite, and newer MariaDB driver.
Add usage output.
Add sanitization test package.
Add newline sanitization back in.
Make use of already existing data type detection from xsxl to better tailor sql column data types.