Created
November 24, 2018 21:08
-
-
Save rvzzz/7c3d045e88f017518da749b5a72849c1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import argparse | |
parser = argparse.ArgumentParser(description='Process some Excel files and insert data into DB') | |
#--------------------------------------------------------- | |
# Excell Args | |
#--------------------------------------------------------- | |
parser.add_argument('-n', '--sheet_name', type=str, required=False, | |
help="name of the sheet to extract the data") | |
parser.add_argument('-r', '--sheet_range', type=str, required=False, | |
help='a range that defines a table') | |
#--------------------------------------------------------- | |
# DB Args | |
#--------------------------------------------------------- | |
parser.add_argument('-H', '--host_name', | |
type=str, required=False, default="localhost", | |
help="Host Name/ Ip Adress") | |
parser.add_argument('-u', '--username', | |
type=str, required=False, default="root", | |
help='User Name to Access DB') | |
parser.add_argument('-pw', '--password', | |
type=str, required=False, default="bazinga", | |
help='Password to Access DB') | |
parser.add_argument('-db', '--database_name', | |
type=str, required=False, default="data_entry_automation_dev", | |
help="name of the database") | |
parser.add_argument('-t', '--table_name', | |
type=str, required=False, | |
help='names of the table columns') | |
parser.add_argument('-c', '--columns', | |
type=str, required=False, nargs="*", | |
help="names of the table columns") | |
args = parser.parse_args() | |
# Excel | |
print("Sheet Name:", args.sheet_name) | |
print("Sheet Range:", args.sheet_range) | |
# Db | |
print("Host Name:", args.host_name) | |
print("User Name:", args.username) | |
print("Pasword:", args.password) | |
print("DB name:", args.database_name) | |
print("Table Name:", args.table_name) | |
print("Columns:", args.columns) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment