title: extract specific cell data from XML .xls file with python
body: <p>I have a giant XML file that is exported from a device as a .xls file. </p>
  
  <pre><code>            &lt;?xml version='1.0'?&gt;
          &lt;?mso-application progid='Excel.Sheet'?&gt;
          &lt;s:Workbook xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:s="urn:schemas-microsoft-com:office:spreadsheet"&gt;
            &lt;s:Styles&gt;
              ...
            &lt;s:Worksheet s:Name="Description"&gt;
         ...
      &lt;s:Worksheet s:Name="Data"&gt;
          &lt;s:Table s:DefaultColumnWidth="100"&gt;
            &lt;s:Row&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;Time&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;Temp1&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;Temp2&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;Liquid&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;Response&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;Base&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;Events&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;Low&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell s:StyleID="Bold"&gt;
                &lt;s:Data s:Type="String"&gt;High&lt;/s:Data&gt;
              &lt;/s:Cell&gt;
              &lt;s:Cell /&gt;
            &lt;/s:Row&gt;
         ...
        &lt;s:Row&gt;
          &lt;s:Cell s:StyleID="Default"&gt;
            &lt;s:Data s:Type="Number"&gt;45&lt;/s:Data&gt; # Time
          &lt;/s:Cell&gt;
            # There is no Temp1 data
          &lt;s:Cell /&gt;
          &lt;s:Cell s:StyleID="Default"&gt;
            &lt;s:Data s:Type="Number"&gt;29.74&lt;/s:Data&gt; # Temp2
          &lt;/s:Cell&gt;
          &lt;s:Cell s:StyleID="Default"&gt;
            &lt;s:Data s:Type="Number"&gt;12.11&lt;/s:Data&gt; # Liquid
          &lt;/s:Cell&gt;
          &lt;s:Cell s:StyleID="Default"&gt;
            &lt;s:Data s:Type="Number"&gt;100&lt;/s:Data&gt; # Response
          &lt;/s:Cell&gt;
          &lt;s:Cell s:StyleID="Default"&gt;
            &lt;s:Data s:Type="Number"&gt;30&lt;/s:Data&gt; # Base
          &lt;/s:Cell&gt;
            # There are no events in this data
          &lt;s:Cell /&gt;
          &lt;s:Cell s:StyleID="Default"&gt;
            &lt;s:Data s:Type="Number"&gt;0&lt;/s:Data&gt; # Low
          &lt;/s:Cell&gt;
          &lt;s:Cell s:StyleID="Default"&gt;
            &lt;s:Data s:Type="Number"&gt;55&lt;/s:Data&gt; # High
          &lt;/s:Cell&gt;
          &lt;s:Cell /&gt;
        &lt;/s:Row&gt;
  </code></pre>
  
  <p>What I am trying to do is extract information from the worksheet named "Data." There are 9 headers for the data, but I am only interested in the data that corresponds to "Time" and "Temp2", which would be "45" and "29.74", respectively.</p>
  
  <p>I have managed to figure out how to navigate the file using:</p>
  
  <pre><code>import xml.etree.ElementTree as ET
  
  tree = ET.parse('xmlfile')
  root = tree.getroot()
  
  ns = {'x':'urn:schemas-microsoft-com:office:excel',
                'o':'urn:schemas-microsoft-com:office:office',
                's':'urn:schemas-microsoft-com:office:spreadsheet'}
  
  root.findall('./s:Worksheet/s:Table/s:Row/s:Cell/s:Data', namespaces=ns)
  </code></pre>
  
  <p>The closest I have gotten to getting the data out of the cells is using an example I found in another post, and trying variations of the following:</p>
  
  <pre><code>for elem in xmlTree.iter():
      if elem.text != None:
          print(elem.text)
  </code></pre>
  
  <p>This outputs <em>everything</em> (all 18901 rows of data), and I do not really know how to proceed from here. Ultimately what I would like to do is to store this data in a data frame or something equivalent so that I may plot it.</p>