very nice, just what i need, does it import xls too? xlsx even?

On May 13, 9:24 am, Bruno Rocha <rochacbr...@gmail.com> wrote:
>  docshttp://docs.tablib.org/en/latest/index.html
> --
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]
>
>
>
> On Fri, May 13, 2011 at 4:13 AM, Bruno Rocha <rochacbr...@gmail.com> wrote:
> >https://github.com/kennethreitz/tablib
>
> > Tablib: format-agnostic tabular dataset library
>
> > headers = ('first_name', 'last_name')
>
> > data = [
> >     ('John', 'Adams'),
> >     ('George', 'Washington')
> > ]
>
> > data = tablib.Dataset(*data, headers=headers)
>
> > Exports
>
> > Drumroll please...........
> > JSON!
>
> > >>> print data.json
> > [
> >   {
> >     "last_name": "Adams",
> >     "age": 90,
> >     "first_name": "John"
> >   },
> >   {
> >     "last_name": "Ford",
> >     "age": 83,
> >     "first_name": "Henry"
> >   }
> > ]
>
> > YAML!
>
> > >>> print data.yaml
> > - {age: 90, first_name: John, last_name: Adams}
> > - {age: 83, first_name: Henry, last_name: Ford}
>
> > CSV...
>
> > >>> print data.csv
> > first_name,last_name,age
> > John,Adams,90
> > Henry,Ford,83
>
> > EXCEL!
>
> > >>> open('people.xls', 'wb').write(data.xls)
>
> > It's that easy.
>
> > *I am wondering something like*
>
> > data = tablib.Dataset(db(db.table.select().as_dict(), headers=headers)
>
> > Then we can have DAL Rows written in to Excel, YAML and JSON.
>
> > --
> > Bruno Rocha
> > [ About me:http://zerp.ly/rochacbruno]

Reply via email to