Is Tablib, been include in web2py?? Seems pretty nice!
I was developping my on lxml custom excel export, so I will be happy if it now available... Richard On Fri, May 13, 2011 at 7:50 AM, selecta <[email protected]> wrote: > very nice, just what i need, does it import xls too? xlsx even? > > On May 13, 9:24 am, Bruno Rocha <[email protected]> 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 <[email protected]> > 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] >

