Skip to main content

A framework to break down Excel Formula strings into a parsable and modifiable JSON data structure.

Project description

ExcelFormulaParser

Description

ExcelFormulaParser extends openpyxl to enhance formula parsing capabilities in Excel spreadsheets. While openpyxl handles spreadsheet management well, its formula parsing features are limited. This project aims to build a robust structure for mapping and manipulating Excel formulas through a comprehensive, user-friendly data structure. Features

 - Formula Parsing: Decompose formulas into a structured format, making them easy to manipulate and analyze.

 - Formula Manipulation: Implement methods like formula.translate() to adjust formulas based on cell repositioning.

 - Analytics: Analyze formulas to extract components count, such as the number of functions used.

Progress and Contributions

The project is in active development, aiming for significant functionality completion by May 2024. Contributions are welcome! If you'd like to help:

Fork the repository and create a pull request with your additions.
Ensure your code is accompanied by updated or new tests that validate your changes.

Current Work

Enhancing the formula.translate() method to shift references based on specified start and end cells.
Developing features to provide analytical insights into formula components.

installation

pip install ExcelFormulaParser

Usage

To use ExcelFormulaParser, start by importing the module and initializing a Formula object with an Excel formula string. Here’s how you can parse a formula and manipulate it:

import ExcelFormulaParser as efp

# Initialize with a formula
f = efp.Formula("=SUM(A1, A2)")

# Access the parsed formula
parsed_formula = f.parsed_formula

# To reflect changes back to a formula string after modifications:
f_str = str(f)  # Outputs the original or modified formula string

# dictionary structure of this formula: 
# {
#     "function': '=SUM(A1, A2)
#     "components": {
#         "name": "SUM"
#         "arguments": [
#             {"reference": "A1"
#              "components": {
#                  "sheet_name": None,
#                  "column_letter": "A",
#                  "column_number": 1,
#                  "row_number": 1}},
#
#             {"reference": "A2"
#              "components": {
#                  "sheet_name": None,
#                  "column_letter": "A",
#                  "column_number": 1,
#                  "row_number": 2}},
#          ]
#     }
# }

Structure

Explore the src/Models directory for class details and src/Tests for unit tests corresponding to each class. The primary interface is through the Formula class, which serves as a facade for the underlying Parser class handling the detailed parsing logic.

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

ExcelFormulaParser-1.0.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

ExcelFormulaParser-1.0.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file ExcelFormulaParser-1.0.0.tar.gz.

File metadata

  • Download URL: ExcelFormulaParser-1.0.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for ExcelFormulaParser-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2d942a07794e23e75e55539e4487c774019e97b0e984f860d5254b9081c64c8d
MD5 c44ff36186d0ec042c8b985fa774763a
BLAKE2b-256 fa8e0b8fc4c5a46830112c33d1142d2147eb21e8e5132ba55c1154484a0c4031

See more details on using hashes here.

File details

Details for the file ExcelFormulaParser-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ExcelFormulaParser-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb9bff203c1dcb088294565836d0a4605d97a8ef7f3f65746ab4833ca8d0d1be
MD5 4889c9501abe76cc1dceb5c338f850d0
BLAKE2b-256 56d175aafdc52a16249b9e82e36a589b17d7c2caee7dc0eaa451256a367d00c7

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