I'm using openpyxl
package in Python(Canopy)
to use excel files. We have this tutorial in this link : LINK
you can also use the openpyxl.worksheet.Worksheet.iter_rows() method:
>>> tuple(ws.iter_rows('A1:C2'))
((<Cell Sheet1.A1>, <Cell Sheet1.B1>, <Cell Sheet1.C1>),
(<Cell Sheet1.A2>, <Cell Sheet1.B2>, <Cell Sheet1.C2>))
>>> for row in ws.iter_rows('A1:C2'):
... for cell in row:
... print cell
<Cell Sheet1.A1>
<Cell Sheet1.B1>
<Cell Sheet1.C1>
<Cell Sheet1.A2>
<Cell Sheet1.B2>
<Cell Sheet1.C2>
How we can import openpyxl.worksheet.Worksheet.iter_rows()
method in python? I used this code:
import openpyxl as op
ms = op.load_workbook('mtest.xlsx')
ws = ms.active
op.worksheet.Worksheet.iter_rows()
This code returns:
type object 'Worksheet' has no attribute 'iter_rows'
What is the problem?