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.
import pandas as pd
import os
import urllib.request
filename = "Livestock Slaughter.txt"
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, "Slaughter Rates.txt")
df = pd.read_csv("Slaughter Rates.txt", sep='\t', skiprows=5, nrows=3)
df.to_excel('Slaughter Data.xlsx')