Skip to main content

Easy viewing/editing of Excel Files

Project description

easierexcel

This modules allows for an easy way to get and update cell values ect...

OpenPyXL is used to do the bulk while easierexcel makes it much easier to use.

Near 100% Test Coverage

Quick Start

Install easierexcel using pip:

$ pip install easierexcel

Example Table

Name Birth Month Age Null
John John 31 null
Michael June 31 null
Brian August 30 null
Rob July 34 null
Allison September 32 null

Code

    from easierexcel import Excel, Sheet

    # class init
    excel = Excel('example_excel.xlsx')

    # formatting options
    options = {
        "shrink_to_fit_cell": True,
        "header": {"bold": True, "font_size": 16},
        "default_align": "center_align",
        "left_align": [
            "Name",
        ],
        "percent": [
            "%",
            "Percent",
            "Discount",
            "Rating Comparison",
            "Probable Completion",
        ],
        "currency": ["Price", "MSRP", "Cost"],
        "integer": ["ID", "Number"],
        "date": ["Last Updated", "Date"],
    }
    example = Sheet(excel, "Name", sheet_name="Example", options=options)

    # deleting
    example.delete_column("Null")
    example.delete_row("John")

    # adding a new line
    data = {
        "Name":"Billy",
        "Birth Month":"December",
        "Age":5,
    }
    example.add_new_line(cell_dict=data)

    # accessing and updating
    example.get_cell("Michael", "Birth Month") # -> June

    example.update_cell("Michael", "Birth Month", "April")

    example.get_cell("Michael", "Birth Month") # -> April

    excel.save() # Saves the excel file

Final Table

Name Birth Month Age
Michael April 31
Brian August 30
Rob July 34
Allison September 32
Billy December 5

Documentation

Excel Class

Excel class is comprised of the excel object that us used to open sheets with the Sheet class.

Saving Excel

Saves the Excel file with a status messages (optional) and backup (optional). It will only save if changes were detected unless force_save is enabled.

def save(
    self,
    use_print: bool = True, # enables status messages
    force_save: bool = False, # force save regardless if changes were detected
    backup: bool = True, # enables excel file backup before save
):

log

def log(self,
    msg: str, # log message
    type: str = "info" # log type
):

Opening the Excel File

Opens the Excel file in Excel. It will save if changes were made before opening.

def open_excel(
    self,
    save: bool = True # Save before opening the excel doc
):

open_file_input

WIP

Sheet Class

WIP

get_cell

WIP

update_cell

WIP

add_new_line

WIP

delete_row

WIP

delete_column

WIP

format_header

WIP

format_cell

WIP

format_row

WIP

format_all_cells

WIP

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

easierexcel-0.9.5.tar.gz (12.7 kB view hashes)

Uploaded Source

Built Distribution

easierexcel-0.9.5-py3-none-any.whl (22.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