title: Read text file into excel without putting all data in first column
body: <p>I have written some code that requests a text file from the web, reads it, and outputs the necessary data into an excel spreadsheet. However, it is not quite in the format I need as it is writing each row as one item, and putting it all into the first column. My code is below, along with an image of the output as my code currently stands. I'd like a column for the date, and then one for each livestock animal with the amount processed.</p>
  <pre><code>import pandas as pd
  import os
  import urllib.request
  
  
  filename = &quot;Livestock Slaughter.txt&quot;
  os.chdir(r'S:\1WORKING\FINANCIAL ANALYST\Shawn Schreier\Commodity Dashboard')
  directory = os.getcwd()
  url = 'https://www.ams.usda.gov/mnreports/sj_ls710.txt'
  data=urllib.request.urlretrieve(url, &quot;Slaughter Rates.txt&quot;)
  df = pd.read_csv(&quot;Slaughter Rates.txt&quot;, sep='\t', skiprows=5, nrows=3)
  df.to_excel('Slaughter Data.xlsx')
  </code></pre>
  <p><a href="https://i.stack.imgur.com/2ljRS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2ljRS.png" alt="Current Output of code" /></a></p>