Code Monkey home page Code Monkey logo

xl-reports's Introduction

XL Reports

Generate Excel reports!

  1. Create an Excel template file
  2. Define a report configuration
  3. Fetch your data
  4. Generate report

Report Configuration Schema

Report configuration is defined as array/list of objects/dicts.

"cell": Worksheet cell coordinates to insert data, example: "B2"

"range": Worksheet coordinate range to insert data. Range start coordinate is required and end coordinate is optional. examples: "B2:" or "B2:C5"

"data_key": Key to use when fetching values from the data dictionary to insert into the worksheet. example: data["report_date"]

"sheet": Worksheet name.

Example configuration

[
    {
        "cell": "B2",
        "data_key": "account",
        "sheet": "my_sheet"
    },
    {
        "cell": "B4",
        "data_key": "report_date",
        "sheet": "my_sheet"
    },
    {
        "range": "A8",
        "data_key": "report_data",
        "sheet": "my_sheet"
    }
]

Example data

[{
    "account": "Engineering",
    "report_date": str(date.today()),
    "report_data": [
        [23.43, 11.96, 9.66],
        [6.99, 65.87, 45.33],
    ]
}]

xl-reports's People

Contributors

gridcell avatar

Watchers

 avatar Angelo Arboleda avatar  avatar

xl-reports's Issues

Would something similar to this approach work?

# Software packages.
import pandas as pd
from datetime import date


# Test data.
test_data = {
                "account": "Engineering",
                "report_date": date.today(),
                "report_data": [
                                    [23.43, 11.96, 9.66],
                                    [6.99, 65.87, 45.33],
                                ]
                }

# Create data frame from JSON data.
df = pd.DataFrame(test_data).explode("report_data")

# Append to an exsisting Excel file.
with pd.ExcelWriter("output.xlsx", mode = "a") as f:  
    df.to_excel(f, sheet_name = "sheet_name", header = False)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.