# exceltopostgresql
Automatically save your local excel files (xlsx,xls,csv) onto Postgresql database
# Introduction
This package help to convert your excel files (xlsx,xls,csv) to postgresql database.
# Installation
exceltopostgresql can be installed as:
```python
pip install exceltopostgresql
```
# Dependency
👍 [pandas](https://pandas.pydata.org/)
👍 [psycopg2](https://pypi.org/project/psycopg2/)
👍 [sqlalchemy](https://www.sqlalchemy.org/)
# QuickStart
```python
import exceltopostgresql as ep
# generate the class instance
# STEP One, prepare your input pareameters
yourFile = "test01.xls" # available for xlsx, xls,csv
yourUsrID = ""
yourPWD = ""
yourDBname= ""
rename_table = ""
# "": save your file name as table name onto posgtresql
# or
# customize your table, like: "test"
# get your local host name
# this will return your local computer name for your sql server database
host_name = ep.hostname
or
host_name = "localhost"
# get your local ip address
# this will return your local ip address (if your sql server can be accessed by DNS)
ip = ep.local_ip
# you need to change your host if needed, dns: local ip address
#yourHostORip = "localhost"
# yourHostORip = host_name
yourHostORip = ip
# STEP Two connect to postgresql server and load your input data
ep.exceltoDBtable(yourFile,yourHostORip,yourUsrID,yourPWD,yourDBname,save2tableName)
# STEP Three, save loaded data onto postgresql
ep.save2db()
```
```
output:
Successfully load excel data...
Secessfully connected to postgresql...
Secessfully saved 'yourtable' to Postgresql...
```
# API Reference
exceltopostgresql.ExcelToDB(`filePath, host_ip="", usrID ="", pwd="", database_name="", port= "5432", rename_table=""`)
```
Args:
filePath (str): [path of your input file name]
host_ip (bool, optional): the ip of your host machine. Defaults to "".
usrID (bool, optional): user id of your postgresql database. Defaults to "".
pwd (bool, optional): password of your postgresql database. Defaults to "".
database_name (bool, optional): the exact database name you want your data save to. Defaults to "".
port (str, optional): the postgresql port. Defaults to "5432".
rename_table (bool, optional): rename your input table.
if "", will use exact the same table name of your input file. Defaults to "".
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Xiangyongluo/exceltopostgresql",
"name": "exceltopostgresql",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "",
"author": "Xiangyong Luo",
"author_email": "rochemay@163.com",
"download_url": "https://files.pythonhosted.org/packages/93/48/e6833da7453a7d9db3230ea139ea27a7baa08c073f5037eb797058fb5f6c/exceltopostgresql-0.2.4.tar.gz",
"platform": null,
"description": "# exceltopostgresql\r\n\r\nAutomatically save your local excel files (xlsx,xls,csv) onto Postgresql database\r\n\r\n# Introduction\r\n\r\nThis package help to convert your excel files (xlsx,xls,csv) to postgresql database.\r\n\r\n# Installation\r\n\r\nexceltopostgresql can be installed as:\r\n\r\n```python\r\npip install exceltopostgresql\r\n```\r\n\r\n# Dependency\r\n\r\n\ud83d\udc4d [pandas](https://pandas.pydata.org/)\r\n\r\n\ud83d\udc4d [psycopg2](https://pypi.org/project/psycopg2/)\r\n\r\n\ud83d\udc4d [sqlalchemy](https://www.sqlalchemy.org/)\r\n\r\n# QuickStart\r\n\r\n```python\r\nimport exceltopostgresql as ep\r\n# generate the class instance\r\n\r\n# STEP One, prepare your input pareameters\r\n\r\nyourFile = \"test01.xls\" # available for xlsx, xls,csv\r\nyourUsrID = \"\"\r\nyourPWD = \"\"\r\nyourDBname= \"\"\r\nrename_table = \"\"\r\n\t# \"\": save your file name as table name onto posgtresql\r\n\t# or\r\n\t# customize your table, like: \"test\"\r\n\r\n# get your local host name\r\n# this will return your local computer name for your sql server database\r\nhost_name = ep.hostname\r\nor\r\nhost_name = \"localhost\"\r\n\r\n# get your local ip address\r\n# this will return your local ip address (if your sql server can be accessed by DNS)\r\nip = ep.local_ip\r\n\r\n# you need to change your host if needed, dns: local ip address\r\n#yourHostORip = \"localhost\"\r\n# yourHostORip = host_name\r\nyourHostORip = ip\r\n\r\n\r\n# STEP Two connect to postgresql server and load your input data\r\nep.exceltoDBtable(yourFile,yourHostORip,yourUsrID,yourPWD,yourDBname,save2tableName)\r\n\r\n# STEP Three, save loaded data onto postgresql\r\nep.save2db()\r\n\r\n```\r\n\r\n\r\n```\r\noutput:\r\nSuccessfully load excel data...\r\nSecessfully connected to postgresql...\r\nSecessfully saved 'yourtable' to Postgresql...\r\n```\r\n\r\n# API Reference\r\n\r\nexceltopostgresql.ExcelToDB(`filePath, host_ip=\"\", usrID =\"\", pwd=\"\", database_name=\"\", port= \"5432\", rename_table=\"\"`)\r\n\r\n```\r\nArgs:\r\n filePath (str): [path of your input file name]\r\n host_ip (bool, optional): the ip of your host machine. Defaults to \"\".\r\n usrID (bool, optional): user id of your postgresql database. Defaults to \"\".\r\n pwd (bool, optional): password of your postgresql database. Defaults to \"\".\r\n database_name (bool, optional): the exact database name you want your data save to. Defaults to \"\".\r\n port (str, optional): the postgresql port. Defaults to \"5432\".\r\n rename_table (bool, optional): rename your input table.\r\n if \"\", will use exact the same table name of your input file. Defaults to \"\".\r\n```\r\n",
"bugtrack_url": null,
"license": "",
"summary": "This package help convert your excel files (xlsx,xls,csv) to Postgresql Database.",
"version": "0.2.4",
"project_urls": {
"Homepage": "https://github.com/Xiangyongluo/exceltopostgresql"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b3dc454dad4799a6d53cd919457a07bf8aabe1b6beadf8382b6cf6fd3ba54ff8",
"md5": "bc5675f9d2c202f606cddc0867179f82",
"sha256": "366b044ee926cead43eb06b7221638d711e375c559e0c0403e830d51279d0c92"
},
"downloads": -1,
"filename": "exceltopostgresql-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc5675f9d2c202f606cddc0867179f82",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5191,
"upload_time": "2024-03-02T02:23:38",
"upload_time_iso_8601": "2024-03-02T02:23:38.652186Z",
"url": "https://files.pythonhosted.org/packages/b3/dc/454dad4799a6d53cd919457a07bf8aabe1b6beadf8382b6cf6fd3ba54ff8/exceltopostgresql-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9348e6833da7453a7d9db3230ea139ea27a7baa08c073f5037eb797058fb5f6c",
"md5": "729f3c9a3ad1aaa0c0f5f18e54202f4f",
"sha256": "00b6935818283e55c7de7ddd5eb5990add7635f890fe79e442a856428f33f018"
},
"downloads": -1,
"filename": "exceltopostgresql-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "729f3c9a3ad1aaa0c0f5f18e54202f4f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4787,
"upload_time": "2024-03-02T02:23:40",
"upload_time_iso_8601": "2024-03-02T02:23:40.049503Z",
"url": "https://files.pythonhosted.org/packages/93/48/e6833da7453a7d9db3230ea139ea27a7baa08c073f5037eb797058fb5f6c/exceltopostgresql-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-02 02:23:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Xiangyongluo",
"github_project": "exceltopostgresql",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "exceltopostgresql"
}