Skip to main content

A CLI tool that converts each sheet of an Excel (`.xlsx`) file into a BSON (Binary JSON) file.

Project description

PyExcelToBSON

🇰🇷 한국어 문서

A CLI tool that converts each sheet of an Excel (.xlsx) file into a BSON (Binary JSON) file.

Requirements

  • Python >= 3.6
  • openpyxl: For reading Excel files
  • pymongo: For BSON serialization (includes bson module)

Installation

pip install pyexcel2bson

Usage

pyexcel2bson -i sample.xlsx -o ./output

Arguments

Argument Description Required
-i, --input Path to the Excel (.xlsx) file
-o, --output Path to the output directory
-s, --suffix Suffix appended to output filenames
-d, --debug Also export as JSON for debugging
-c, --clean Clean up the output directory before converting

Excel Sheet Rules

  1. Sheets whose name starts with _ are skipped.

    • e.g. _info
  2. Rows 1–5 must follow this structure:

Row Description
1 Column description
2 Column usage (reserved)
3 Column attribute
4 Column data type
5 Column name (variable name)
  1. Data cells must not be empty.

Output Format

Each sheet is exported as a .bson file with the following structure:

{
  "data": [
    { "column_name": value, ... },
    ...
  ]
}

Development

git clone https://github.com/onsemy/PyExcelToBSON.git
cd PyExcelToBSON
pip install -e ".[dev]"

Project Structure

PyExcelToBSON/
├── main.py
├── output_manager.py
├── readers/
│   ├── input_reader.py    # Abstract base class
│   └── excel_reader.py
├── writers/
│   ├── output_writer.py   # Abstract base class
│   ├── bson_writer.py
│   └── json_writer.py
└── factories/
    ├── reader_factory.py
    └── writer_factory.py

Contributing

Please open an Issue or send an email.

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

pyexcel2bson-0.1.8.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyexcel2bson-0.1.8-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file pyexcel2bson-0.1.8.tar.gz.

File metadata

  • Download URL: pyexcel2bson-0.1.8.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

File hashes

Hashes for pyexcel2bson-0.1.8.tar.gz
Algorithm Hash digest
SHA256 25f840bd7106cc11d3e2a53755c508a0329b722d4cbf23b43859a01c5ea223a6
MD5 47a888baa608ea6a3b9e538fa90937e7
BLAKE2b-256 ad745e7eef1c4d0b8b6b309055a5a650e08db86b07651cd25d58b9b65563ebab

See more details on using hashes here.

File details

Details for the file pyexcel2bson-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: pyexcel2bson-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

File hashes

Hashes for pyexcel2bson-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e27b376d5da3fe7d8a4d066494634db0673717884a79ece71d431e5a4e7b0fcc
MD5 9b18dfb21529c90f0541758f6c9bb685
BLAKE2b-256 db1888eca7f3fea92a7a4dc7a4c5486c7efdb833eeace575669267b97353394e

See more details on using hashes here.

Supported by

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