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.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ExcelFormulaParser-1.0.1.tar.gz
  • Upload date:
  • Size: 16.3 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.1.tar.gz
Algorithm Hash digest
SHA256 164a84f568696a9bb2e270fb2260df21b90892ebeb0e30595540de580095beef
MD5 214e881cb161d6fde5359b74bb11c0cf
BLAKE2b-256 7bbf10d3123f28ddff9d7ac9b0adb6d6574125e20d2a56524059c5c6e88a9ce7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ExcelFormulaParser-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9b19c0fead80af885d60f1e1764c6a1969741278eea9ed392dca205f0c41442
MD5 711976e94702888474a0e595b7364872
BLAKE2b-256 5245c0f8b19b7babcefc378826beab93c53e830a1254a72246db2fe1b1af9b7c

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