-2146826246 in win32com.client for empty #N/A cell in Excel

Albert-Jan Roskam sjeik_appie at hotmail.com
Sun Aug 16 13:27:27 EDT 2015



> Date: Sun, 16 Aug 2015 09:53:32 -0700
> Subject: -2146826246 in win32com.client for empty #N/A cell in Excel
> From: sven.boden at gmail.com
> To: python-list at python.org
> 
> 
> Anyone know how to handle "#N/A" in Excel from win32com.client.
> 
> I'm extracting data from an Excel file using win32com.client. Everything works fine except for when the value "#N/A" is entered in excel. An empty cell. I assumed I do something as 
> 
> if ws.Cells(r, c).Value is None:
>     ...
> 
> But that doesn't seem to work. When I debug the piece of code while handling #N/A in a cell the type of the cell according to win32com.client is int and the value in the cell is -2146826246. Chances are small just this number will appear in Excel, but it looks dirty to depend on that value to decide if a cell is empty. Looked around the net for a solution, but nothing came up so far.
> 
> Anyone knows how to handle a "#N/A" cell in Excel in the proper way?
> 
> Regards,
> Sven
> -- 
> https://mail.python.org/mailman/listinfo/python-list


Hello,
Does that number happen to be -1 * sys.maxint?
Regards,Albert-Jan

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150816/7110ca96/attachment.html>


More information about the Python-list mailing list