Skip to main content

Simple library to write excel files from Python Dictionary or Pandas DataFrame.

Project description

Copyright (c) 2023-Present EncoreSky Technologies Pvt. Ltd. All rights reserved.

Excel Writer

version

excel_writer is a package containing the methods for creating excel file from python dictionary or pandas dataframe.

Prerequisites

You'll also need the following:

  • Python, excel_writer is compatible with version >=3.8.11.

Installation

To install the package (in either a system-wide or a virtual environment), navigate to the excel_writer root folder in a Terminal, and type:

pip install excel-writer

excel_writer will be installed as a package in your Python distribution, along with it's dependencies if necessary.

N.B. - installing in a virtual environment is recommended.

Usage

Input Format

Supported input format for dictionary is as follows:

{
    <column_name>: [<row_value>, <row_value>, . . . .],
    <column_name>: [<row_value>, <row_value>, . . . .],
    .
    .
    .
    .
}

Write a file using dictionary

from excel_writer import ExcelWriter

input_data = {
    "Name": ["Aarav", "Jayesh", "Vineet", "Rahul", "Mayank", "Deepak"],
    "Age": [24, 28, 27, 25, 28, 35],
    "Emp Id": ["A-001", "A-002", "A-003", "A-004", "A-005", "A-006"],
    "City": ["Indore", "Bhopal", "Gwalior", "Pune", "Kolkata", "Udaipur"],
    "Has Bike": ["Y", "Y", "Y", "Y", "Y", "Y"]
}

excel_writer = ExcelWriter(file_name="test.xlsx", 
                            sheet_name="sheet_1")

excel_writer.write_data(data_dict = input_data)

Write a file using pandas dataframe

import pandas as pd
from excel_writer import ExcelWriter

input_data = {
    "Name": ["Aarav", "Jayesh", "Vineet", "Rahul", "Mayank", "Deepak"],
    "Age": [24, 28, 27, 25, 28, 35],
    "Emp Id": ["A-001", "A-002", "A-003", "A-004", "A-005", "A-006"],
    "City": ["Indore", "Bhopal", "Gwalior", "Pune", "Kolkata", "Udaipur"],
    "Has Bike": ["Y", "Y", "Y", "Y", "Y", "Y"]
}

data_df = pd.DataFrame(input_data)
excel_writer = ExcelWriter(file_name="test.xlsx", 
                            sheet_name="sheet_1")

excel_writer.write_data(data_df = data_df)

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

excel_writer-1.0.5.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file excel_writer-1.0.5.tar.gz.

File metadata

  • Download URL: excel_writer-1.0.5.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.11

File hashes

Hashes for excel_writer-1.0.5.tar.gz
Algorithm Hash digest
SHA256 83864f549c74a740199f5a2186b126aced1a551023c067d0d80674f69e77fcc6
MD5 5b06596a764d1d257eb6708a548a88e4
BLAKE2b-256 9cb3021d09e68129e20f3082ae7f04d46df5c54fd5c2cd744492811acc9c01e0

See more details on using hashes here.

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