AnsweredAssumed Answered

Make SearchCursor from Excel table?

Question asked by rmartin4 on Oct 1, 2012
Latest reply on Oct 2, 2012 by jskinner-esristaff
Hi all,

I am having a heck of a time making a SearchCursor from an Excel table with a WHERE query. I made a test table with just one column called NAME and a cursor as follows:

where = '\"NAME\" = \'Tom\'' rows = arcpy.SearchCursor("Sheet1$", where)

This works fine. But when I loop over the rows and print NAME nothing happens (I'm guessing no rows satisfy the query, though the data is there). Conversely if I change the statement to:

where = '\"NAME\" <> \'Tom\''

it returns ALL rows. Obviously the WHERE clause is not working, but it looks fine to me and I don't get any syntax errors. Can anyone think of what might be happening here? Maybe an Excel peculiarity?