Openpyxl - How to read int value from cells in excel file

Issue #364 resolved
Shaun Thomas created an issue

I have the following sample code;

from openpyxl import load_workbook

print "Going to execute the script"

workbook = load_workbook("SampleExcel.xlsx", use_iterators = True)

for worksheet in workbook:
    for row in worksheet.iter_rows():
        for cell in row:
            if(cell.value != None):
                print cell.value            

print "End of script execution"

Some cells in my excel files have non-decimal values like 1, 22, 732 etc. But cell.value is giving me these values as 1.0, 22.0, 732.0 etc. This is the issue.

I have attached the excel file which I have used.

This ticket has reference to stackoverflow question >

Comments (4)

  1. Log in to comment