Open david08-08 opened 2 weeks ago
Can you post the error here? Thanks
if name == 'main': output_path = Path('/Users/name/Documents/Apple_Financials_2013_2023.xlsx')
with output_path.open('wb') as f:
with ExcelWriter(f, engine='xlsxwriter') as writer:
for year in range(2013, 2023 + 1):
try:
# Retrieve the 10-K filing for the given year
filings = Company("AAPL").get_filings(form="10-K")
filing_for_year = next(filing for filing in filings if filing.filing_date.year == year)
# Process the XBRL data for the filing
xbrl = filing_for_year.xbrl()
# Write the statements to the Excel workbook
write_statements(xbrl, writer, year)
except StopIteration:
print(f"No 10-K filing found for year {year}")
except Exception as e:
print(f"Error processing year {year} for AAPL: {str(e)}")
I am trying to pull 10-K for multiple years but I keep getting an error in the output. Can someone please give me some guidance on how to put the code together for this task. Below is what I put together but I keep getting an error. Thank you.
if name == 'main': output_path = Path('/Users/name/Documents/Apple_Financials_2013_2023.xlsx')