The below shows an example of how to iterate thru cells ...
#!/usr/bin/env python
import openpyxl
from pprint import pprint
wb = openpyxl.reader.excel.load_workbook('test.xlsx')
s = wb.get_sheet_by_name(name='Sheet1')
d = s.calculate_dimension()
r = s.range(d)
print "Range:" + str(r)
for row in r:
for cell in row:
print cell.get_coordinate()
print cell.value
%python
>>> import openpyxl
>>> help(openpyxl.reader.excel)
>>> wb = openpyxl.reader.excel.load_workbook('test.xlsx')
>>> help(wb)
>>> ws = wb.get_sheet_by_name(name='Sheet1')
>>> help(ws)
>>> cell = ws.cell(row=0, column=0)
>>> help(cell)
No comments:
Post a Comment