title: How to check if .xls and .csv files are empty
body: <p>Question 1: How can I check if an entire .xls or .csv file is empty.This is the code I am using:</p>
  
  <pre><code>try:
      if os.stat(fullpath).st_size &gt; 0:
         readfile(fullpath)
      else:
         print "empty file"
  except OSError:
      print "No file"
  </code></pre>
  
  <p>An empty .xls file has size greater than 5.6kb so it is not obvious whether it has any contents. <strong>How can I check if an xls or csv file is empty?</strong></p>
  
  <p>Question 2: I need to check the header of the file. <strong>How can I tell python that files which are just a single row of headers are empty?</strong></p>
  
  <pre><code>import xlrd
  def readfile(fullpath)
      xls=xlrd.open_workbook(fullpath)  
      for sheet in xls.sheets():
          number_of_rows = sheet.nrows 
          number_of_columns = sheet.ncols
          sheetname = sheet.name
          header = sheet.row_values(0) #Then if it contains only headers, treat it as empty.
  </code></pre>
  
  <p>This is my attempt. How do I continue with this code?</p>
  
  <p>Please provide a solution for both questions. Thanks in advance.</p>