Community mailing list archives

Re: how to read XLS file in Odoo

Amol Gangajaliwale
- 09/12/2014 08:29:21
Hi Team,

This Module to export current active tree view  exactly same in to excel report



Amol Gangajaliwale


On Fri, Sep 12, 2014 at 5:30 PM, Markus Schneider <> wrote:

We read xls files with xlrd python lib [1] and this works really great.
We combine this with our connector_flow [2] module. But no need for
this. So first Task reads xls and make chunks of rows. The second task
import the chanks in what ever you need.

In our use case we implemented this to import a excel list with
inventory correction.

So the mayn code looks like:

from xlrd import open_workbook

#it is meta object of ir.attachment
file_obj = self.session.pool.get('impexp.file')
f = file_obj.browse(, self.session.uid, file_id)
data_file = b64decode(f.attachment_id.datas)

wb = open_workbook(file_contents=data_file)
for s in wb.sheets():
    for row in range(s.nrows):
        data_row = []
        for col in range(s.ncols):
            value = (s.cell(row, col).value)

The Code is part of a bigger module where all the mapping stuff is hard
codet so we need to make a complete example but at the moment not time
for this.

Kind Regards


On 11.09.2014 16:15, abhishek jaiswal wrote: > Hi all, > > Can any body please tell how to read and process excel file in Odoo or > any example > > it will be very help full thanks > > -- > With Warm Regards > Abhishek Jaiswal, > > _______________________________________________ > Mailing-List: > Post to: > Unsubscribe:
> -- Dipl.-Comp.-Math. Markus Schneider Softwareentwickler initOS GmbH & Co. KG An der Eisenbahn 1 21224 Rosengarten Mobil: +49 (0)172 2303699 Phone: +49 (0)4105 5615613 Fax: +49 (0)4105 5615610 Email: Web: Geschäftsführung: Dipl. Wirt.-Inf. Frederik Kramer & Dipl.-Ing. (FH) Torsten Francke Haftende Gesellschafterin: initOS Verwaltungs GmbH Sitz der Gesellschaft: Rosengarten – Klecken Amtsgericht Tostedt, HRA 201840 USt-IdNr: DE 275698169 Steuer-Nr: 15/205/21402

Post to: