Package to write data from database to excel files
Project description
EaseExcel
EaseExcel is a Python package designed to facilitate the transfer of data from databases to Excel. It seamlessly integrates with SQLAlchemy, supporting connections to various database types.
Installation
If you encounter any errors during installation, you may need to install the following packages before trying again:
pip install SQLAlchemy XlsxWriter
Usage
# Import statments
from sqlalchemy import create_engine
from sqlalchemy import text
import asyncio
from EaseExcel.src.Excel.ease_excel import EaseExcel
# Example 1
async def main():
"""
In this example providing sql alchmey engine and sql query as argument
These are required argument
"""
engine = create_engine('postgresql+psycopg2://username:password@host:port/database')
query = "select * from posts"
await EaseExcel(
sqlalchemy_engine=engine,
SQL_query=query).build()
asyncio.run(main())
# Example 2
async def main():
"""
In this example providing sql alchmey engine, sql query and filename as argument
file_name: it is optional argument if filename is not provided file will we created with
default name.
"""
engine = create_engine('postgresql+psycopg2://username:password@host:port/database')
query = "select * from posts"
await EaseExcel(
sqlalchemy_engine=engine,
SQL_query=query,
file_name='Posts').build()
asyncio.run(main())
# Example 3
async def main():
"""
In this example providing sql alchmey engine, sql query and filename as argument
file_name: it is optional argument if filename is not provided file will we created with
default name.
file_path: it is also a optional argument if this is not provided file will be create in current directory.
"""
engine = create_engine('postgresql+psycopg2://username:password@host:port/database')
query = "select * from posts"
await EaseExcel(
sqlalchemy_engine=engine,
SQL_query=query,
file_name='Posts'.
file_path='<path>').build()
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
EaseExcel-1.0.2.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for EaseExcel-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d85a887e68de5d3b41b1e875ac298e1677139696cbcd36bf001be096bd3f127 |
|
MD5 | 5e26905a642f7f0ef9d1940d1fc9d674 |
|
BLAKE2b-256 | fc594bc23cddf98924f1cc4e6ddf139e254bb273d72abf661fd31aebdffab93e |