title: Openpyxl/Pandas - Convert CSV to XLSX
body: <p>I'm trying to convert a <code>CSV</code> file to an <code>Excel</code> file but after trying most of the suggestions from the web, the closest I got is using this piece of code:</p>
  
  <p>Input file looks like <a href="https://i.stack.imgur.com/9X8VR.jpg" rel="nofollow noreferrer">this</a></p>
  
  <pre><code>pathcsv = r'C:\Users\Python\test.csv'
  pathxls = r"C:\Users\Python\test123.xlsx"
  
  
  wb = Workbook()
  ws = wb.active
  
  with open('test.csv', 'r') as f:
      for row in csv.reader(f):
          ws.append(row)
  
  wb.save(pathxls)   
  </code></pre>
  
  <p>Problem in here is that the output file looks like <a href="https://i.stack.imgur.com/JaICw.jpg" rel="nofollow noreferrer">this</a> (see highlighted)</p>
  
  <p>Another try was with <code>pandas</code>.</p>
  
  <pre><code>data = pd.read_csv(pathcsv, sep="\t")
  df = pd.DataFrame(data)
  df.to_excel(pathxls, index=False)
  </code></pre>
  
  <p>But the output looked like <a href="https://i.stack.imgur.com/x2LUI.jpg" rel="nofollow noreferrer">this</a></p>
  
  <p>Does anyone got any clue on how to solve this? </p>
  
  <p>Thank you!</p>