win32com: how to tell if an excel cell is empty
Robin Becker
robin at jessikat.fsnet.co.uk
Tue Oct 31 04:04:49 EST 2000
More information about the Python-list mailing list
Tue Oct 31 04:04:49 EST 2000
- Previous message (by thread): win32com: how to tell if an excel cell is empty
- Next message (by thread): Python processing of an input byte stream
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <39FE48C9.B4F00766 at gowebway.com>, Harold Howe <hhowe at gowebway.com> writes ... >import win32com.client >excel = win32com.client.Dispatch("Excel.Application") >wkbook = excel.Workbooks.Open('foo.xls') >sheet = wkbook.Sheets("Sheet1") > >cell = sheet.Cells(1,1) > >if(cell == None): > print "empty" > >if(cell == 0): > print "empty" > >if(cell == "None"): > print "empty" > ... I would try sheet.Cells(1,1).Value and then test against None or ''. ie v = sheet.Cells91,1).Value if v is None or str(v)=='': print 'Empty' of course if you are reading a numeric array then perhaps any blank string cell should be regarded as zero or some other default. -- Robin Becker
- Previous message (by thread): win32com: how to tell if an excel cell is empty
- Next message (by thread): Python processing of an input byte stream
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list