All Projects → ebsaral → hfexcel

ebsaral / hfexcel

Licence: BSD-3-Clause license
JSON to Excel in Python. 🐍 Human Friendly excel creation in python. 📄 easy, advanced and smart api. json to excel conversion support.. ❤️

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to hfexcel

Php Ext Xlswriter
🚀 PHP Extension for creating and reader XLSX files.
Stars: ✭ 1,734 (+10737.5%)
Mutual labels:  excel, xlsx, xlsxwriter
xlsx reader
A production-ready XLSX file reader for Elixir.
Stars: ✭ 46 (+187.5%)
Mutual labels:  excel, xlsx
excel-merge
A PHP library to merge two or more Excel files into one
Stars: ✭ 26 (+62.5%)
Mutual labels:  excel, xlsx
spreadsheet
Yii2 extension for export to Excel
Stars: ✭ 79 (+393.75%)
Mutual labels:  excel, xlsx
xlsx-js-style
SheetJS Community Edition + Basic Cell Styles
Stars: ✭ 129 (+706.25%)
Mutual labels:  excel, xlsx
fxl
fxl is a Clojure spreadsheet library
Stars: ✭ 117 (+631.25%)
Mutual labels:  excel, xlsx
eec
A fast and lower memory excel write/read tool.一个非POI底层,支持流式处理的高效且超低内存的Excel读写工具
Stars: ✭ 93 (+481.25%)
Mutual labels:  excel, xlsx
xlsx-reader
xlsx-reader is a PHP library for fast and efficient reading of XLSX spreadsheet files. Its focus is on reading the data contained within XLSX files, disregarding all document styling beyond that which is strictly necessary for data type recognition. It is built to be usable for very big XLSX files in the magnitude of multiple GBs.
Stars: ✭ 40 (+150%)
Mutual labels:  excel, xlsx
spark-hadoopoffice-ds
A Spark datasource for the HadoopOffice library
Stars: ✭ 36 (+125%)
Mutual labels:  excel, xlsx
sheet2dict
Simple XLSX and CSV to dictionary converter
Stars: ✭ 206 (+1187.5%)
Mutual labels:  excel, xlsx
MiniExcel
Fast, Low-Memory, Easy Excel .NET helper to import/export/template spreadsheet
Stars: ✭ 996 (+6125%)
Mutual labels:  excel, xlsx
xltpl
A python module to generate xls/x files from a xls/x template.
Stars: ✭ 46 (+187.5%)
Mutual labels:  excel, xlsx
easy-excel
🚀 快速读写Excel文件,简单高效
Stars: ✭ 118 (+637.5%)
Mutual labels:  excel, xlsx
Dexiom.EPPlusExporter
A very simple, yet incredibly powerfull library to generate Excel documents out of objects, arrays, lists, collections, etc.
Stars: ✭ 19 (+18.75%)
Mutual labels:  excel, xlsx
Qxlnt
Use xlnt in Qt 5 or 6. xlnt is cross-platform user-friendly xlsx library for C++14.
Stars: ✭ 66 (+312.5%)
Mutual labels:  excel, xlsx
OpenSpreadsheet
OpenSpreadsheet provides an easy-to-use wrapper around the OpenXML spreadsheet SAX API. It specializes in efficiently reading and writing between strongly typed collections and worksheets.
Stars: ✭ 24 (+50%)
Mutual labels:  excel, xlsx
excelizor
A simple tool to export .xlsx files to lua-table, json and their corresponding csharp classes and golang structs
Stars: ✭ 35 (+118.75%)
Mutual labels:  excel, xlsx
laravel-xlswriter
an excel export/import tool for laravel based on php-xlswriter
Stars: ✭ 54 (+237.5%)
Mutual labels:  excel, xlsx
xls2db
Export table data from excel to mysql database, implemented with python.
Stars: ✭ 33 (+106.25%)
Mutual labels:  excel, xlsx
umya-spreadsheet
A pure rust library for reading and writing spreadsheet files
Stars: ✭ 79 (+393.75%)
Mutual labels:  excel, xlsx

hfexcel 0.0.17 CircleCI codecov

human friendly excel creation in python. simplicity within a certain complexity..

development versions of dependencies

  • Python 3.x
  • XlsxWriter==1.1.8
  • jsonschema==2.6.0
  • pytest
  • codecov
  • pytest-cov

install

pip install hfexcel

features

  • Human readable coding, building
  • Support for any custom json schema: flexible api to build a helper of your own. There are already two helpers which you can see in the examples.
  • Object-Obriented based readable models: HFExcelWorkbook, HFExcelSheet, HFExcelColumn, HFExcelColumn
  • HFExcelWorkbookFilter: Helper class to populate Excel from a JSON data (python dict) with a pre-defined json schema. (default:hfexcel.schemas.DEFAULT_SCHEMA)
  • HFExcelWorkbook.output: Output creation on filename (string) input being null, and created output parameter with the type BytesIO linked to workbook itself

playground

example of converting nested objects {sheet>column>row} input from json format into excel format

from hfexcel import HFExcel
from hfexcel.schemas import DEFAULT_SCHEMA


excel_data = {
    "sheets": [
        {
            "key": "sheet1",
            "name": "Example Sheet 1",
            "columns": [
                {
                    "name": "Column 1",
                    "width": 2,
                    "args": [
                        "headline"
                    ],
                    "rows": [
                        {
                            "data": "Column 1 Row 1"

                        },
                        {
                            "data": "Column 1 Row 2"
                        }
                    ]
                },
                {
                    "name": "Column 2",
                    "rows": [
                        {
                            "data": "Column 2 Row 1",
                        },
                        {
                            "data": "Column 2 Row 2",
                        }
                    ]
                },
                {
                    "name": "Column 3",
                    "rows": [
                        {
                            "data": "Column 3 Row 1"
                        },
                        {
                            "data": "Column 3 Row 2"
                        }
                    ]
                }
            ]
        }
    ],
    "styles": [
        {
            "name": "headline",
            "style": {
                "bold": 1,
                "font_size": 14,
                "font": "Arial",
                "align": "center"
            }
        }
    ]
}

hf_workbook = HFExcel.hf_workbook('example.xlsx', set_default_styles=False)
hf_workbook.filter().populate_with_json(excel_data, schema=DEFAULT_SCHEMA)
hf_workbook.save()

example of object-oriented python syntax

from hfexcel import HFExcel

hf_workbook = HFExcel.hf_workbook('example.xlsx', set_default_styles=False)

hf_workbook.add_style(
    "headline", 
    {
        "bold": 1,
        "font_size": 14,
        "font": "Arial",
        "align": "center"
    }
)

sheet1 = hf_workbook.add_sheet("sheet1", name="Example Sheet 1")

column1, _ = sheet1.add_column('headline', name='Column 1', width=2)
column1.add_row(data='Column 1 Row 1')
column1.add_row(data='Column 1 Row 2')

column2, _ = sheet1.add_column(name='Column 2')
column2.add_row(data='Column 2 Row 1')
column2.add_row(data='Column 2 Row 2')


column3, _ = sheet1.add_column(name='Column 3')
column3.add_row(data='Column 3 Row 1')
column3.add_row(data='Column 3 Row 2')

# In order to get a row with coordinates:
# sheet[column_index][row_index] => row
print(sheet1[1][1].data)
assert(sheet1[1][1].data == 'Column 2 Row 2')

hf_workbook.save()

example of converting inline index-based {sheet>[column:row]} input from json format into excel format

from hfexcel import HFExcel
from hfexcel.extras import InlineInputHelper

excel_data = {
    "sheets": [
        {
            "key": "sheet1",
            "name": "Example Sheet 1",
            "columns": [
                {
                    "name": "Column 1",
                    "width": 2,
                    "args": [
                        "headline"
                    ]
                },
                {
                    "name": "Column 2"
                }
            ],
            "rows": [
                [
                    {
                        "data": "Column 1 Row 1"

                    },
                    {
                        "data": "Column 2 Row 1"
                    }
                ],
                [
                    {
                        "data": "Column 1 Row 2"

                    },
                    {
                        "data": "Column 2 Row 2"
                    }
                ]
            ]
        }
    ],
    "styles": [
        {
            "name": "headline",
            "style": {
                "bold": 1,
                "font_size": 14,
                "font": "Arial",
                "align": "center"
            }
        }
    ]
}

hf_workbook = HFExcel.hf_workbook(filename, set_default_styles=False)
InlineInputHelper(hf_workbook).populate_with_json(excel_data)
hf_workbook.save()
return True

example output file

contributors

  • @ebsaral - author
  • feel free to contribute

dependencies

warning

  • Happy path tests are written.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].