https://github.com/dxe4/xls_to_mysql_insert
Create sql inserts from excel files
https://github.com/dxe4/xls_to_mysql_insert
Last synced: over 1 year ago
JSON representation
Create sql inserts from excel files
- Host: GitHub
- URL: https://github.com/dxe4/xls_to_mysql_insert
- Owner: dxe4
- Created: 2013-09-20T21:56:06.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-09-29T22:11:50.000Z (over 12 years ago)
- Last Synced: 2025-03-23T10:35:22.460Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 9.83 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
xls_to_mysql_insert
===================
Create sql insert files from excel files
git clone https://github.com/papaloizouc/xls_to_mysql_insert.git
Tested on windows xp 32bit and arch linux.
You only have to install python3.3.
If for some reason the sh/bat file won't work you here's the instructions to get the libraries you need:
Windows (optional)
download python3.3
download http://python-distribute.org/distribute_setup.py
run python distribute_setup.py (on windows you may have to add to path C:\Python33)
run C:\Python33\Scripts\easy_install xlrd
Linux (optional)
download python3.3
wget http://python-distribute.org/distribute_setup.py
python3.3 distribute_setup.py
easy_install-3.3 xlrd
#Examples:
Run flat mode:
---
windows: flat_mode.bat doc\example_flat.xls
linux: ./flat_mode.sh doc/example_flat.xls
manualy: python xtsi.py doc/example_flat.xls f
Input Flat Mode:
---

Output Flat Mode:
---
example_flat.sql:
```mysql
INSERT INTO `the_schema`.`the_table`
(`col100000` ,`col2` ,`col3` )
VALUES
(`val13` ,`val24` ,`val35` )
;
```
```mysql
INSERT INTO `the_schema`.`Table_2`
(`col1` ,`col2` ,`col3` )
VALUES
(`901` ,NULL ,`3` )
(`3213` ,`54` ,NULL )
(NULL ,`765765` ,NULL )
(NULL ,`55.55` ,`90909090` )
(NULL ,NULL ,curdate() )
;
```
Run sheet mode:
---
windows: sheet_mode.bat doc\example_sheet.xls
linux: ./sheet_mode.sh doc/example_sheet.xls
manualy: python xtsi.py doc/example_sheet.xls
Input Sheet Mode:
---

Output Sheet Mode:
---
example_sheet.sql:
```mysql
INSERT INTO `sheet_schema`.`table_name`
(`col1` ,`col2` ,`col3` ,`col000000000000000000000` )
VALUES
(`1` ,`a` ,NULL ,NULL )
(`2` ,`b` ,`33.33` ,`99.99` )
(`3` ,`very big row must be allgined` ,NULL ,`5f34` )
(`4` ,`d` ,`321` ,`5fe` )
(`5` ,NULL ,NULL ,NULL )
;
```