<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Make SearchCursor from Excel table? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216659#M16675</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try placing the field name in brackets.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;where = "[First Name] = 'Tom'"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Oct 2012 18:53:03 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2012-10-02T18:53:03Z</dc:date>
    <item>
      <title>Make SearchCursor from Excel table?</title>
      <link>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216656#M16672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;where = '\"NAME\" = \'Tom\'' rows = arcpy.SearchCursor("Sheet1$", where)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;where = '\"NAME\" &amp;lt;&amp;gt; \'Tom\''&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 22:08:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216656#M16672</guid>
      <dc:creator>RobertMartin2</dc:creator>
      <dc:date>2012-10-01T22:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Make SearchCursor from Excel table?</title>
      <link>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216657#M16673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try changing your where clause to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;where = "NAME = 'Tom'"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2012 09:49:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216657#M16673</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-10-02T09:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Make SearchCursor from Excel table?</title>
      <link>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216658#M16674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Jake, that did the trick for that table. The only issue is that my actual data has spaces in the column names, so I think I need the quotes. Any thoughts on how to incorporate those?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried something like&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;where = "\"FIRST NAME\" = 'Tom'"&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;and the cursor generated fine, but with no rows.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2012 17:16:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216658#M16674</guid>
      <dc:creator>RobertMartin2</dc:creator>
      <dc:date>2012-10-02T17:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Make SearchCursor from Excel table?</title>
      <link>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216659#M16675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try placing the field name in brackets.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;where = "[First Name] = 'Tom'"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2012 18:53:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/make-searchcursor-from-excel-table/m-p/216659#M16675</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-10-02T18:53:03Z</dc:date>
    </item>
  </channel>
</rss>

