GithubHelp home page GithubHelp logo

brexcel's Introduction

brexcel

MOTIVATION

Recently, I had to parse lots of excel files that were sent by bussiness departs and some IT apps. I had to parse these excel files and enrich them with other data (metrics, documentation, etc).

My main motivation to create this python module was to automate the parse and creation of excel files.

I never packaged a python project so... my second motivation is to package a python project.

What brexcel does

Simply:

  • reads an excel file into a dict
  • writes a dict into an excel file

Reading excel files

# coding=utf8
from brexcel.rexcel import RExcel
from pprint import pprint

f = RExcel('ISO3166-2.xlsx')
arr = f.getDictByField('Code', ['Name'])

pprint(arr)

Writing excel files

from brexcel.wexcel import WExcel

arr = [{'Name': u'root node',  'top_id': '',  'id': '1'},
       {'Name': u'First Leaf',  'top_id': '1',  'id': '2'},
       {'Name': u'Second leaf inside root node',  'top_id': '1',  'id': '3'},
       {'Name': u'another root node',  'top_id': '',  'id': '4'}]

f = WExcel(arr)
f.header_order = ['id', 'top_id', 'Name']
f.header_alias = {'id': 'id', 'top_id': 'Top Node'}
f.SaveExcelAs('myfilename.xlsx', 'Sheet1')

The above will create an excel file like this:

id Top Node Name
1 root node
2 1 First Leaf
3 1 Second leaf inside root node
4 another root node

Be free to ask any question in brexcel group: https://groups.google.com/forum/#!forum/brexcel

Note:

  • See the test files inside tests folder.

brexcel's People

Contributors

bitfhacker avatar brunogoncalooliveira avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

hoadu

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.