Skip to content

Python script for importing data from .csv, .xls, or .xlsx to MySQL database.

License

Notifications You must be signed in to change notification settings

sartim/MySql-Python-Import-Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySql-Python-Import-Script

Python script for importing data from .csv, .xls, or .xlsx to MySql database. It requires the headers to run an insert query to database using the headers as the fields.

Setup

Requirements

Setup

$ virtualenv <envname> -p python3
$ source <envname>/bin/activate
$ pip install -r requirements.txt

Running script

$ python import.py -h
$ python import.py -t spreadsheet -f data/users.xlsx -s source -H hostname.com -U username -P pwd -D db_name
$ python import.py -t csv -f data/users.csv -H hostname.com -U username -P pwd -D db_name
arguments

-t (type)

spreadsheet, csv

-f (file)

Path to dataset file

-s (sheet name)

Used if the dataset type in use is a spreadsheet

-H (host name)

Database host name

-U (username)

Database username

-P (password)

Database password

-D (database name)

Database name

About

Python script for importing data from .csv, .xls, or .xlsx to MySQL database.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages