Skip to main content

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


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)

Uploaded Source

Built Distribution

EaseExcel-1.0.2-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page