title: Csvkit Library Usage
body: <p>I'm looking to convert a given excel file to a csv using <a href="https://csvkit.readthedocs.io/en/1.0.1/index.html" rel="nofollow noreferrer">csvkit</a> as a library, not from the command line. I'm having trouble finding any information on library usage syntax. Can anyone shed some light on how to use csvkit as a library for this purpose? </p>
  
  <p>My test case is simple - take input.xlsx or input.xls, convert, and save as output.csv. Here's what I've tried so far, which is based on suggestions found elsewhere :</p>
  
  <pre><code>import csvkit
  
  with open('input.xlsx') as csvfile:
      reader = in2csv(csvfile)
      # below is just to test whether the file could be accessed
      for row in reader:
          print(row)
  </code></pre>
  
  <p>gives </p>
  
  <pre><code>Traceback (most recent call last):
    File "excelconvert.py", line 6, in &lt;module&gt;
      reader = in2csv(csvfile)
  NameError: name 'in2csv' is not defined
  </code></pre>
  
  <p>There's a similar question <a href="https://stackoverflow.com/questions/28483471/how-to-import-and-use-csvkit-in-a-python-script">here</a>, but the answers just seem to reference documentation that either isn't up or doesn't actually explain library usage syntax, it just lists classes. There is an answer suggesting the syntax might be similar to the csv module, which is what I used to make the attempt above, but I'm getting nowhere.</p>