SEC SEC Financial Statement Extractor - get_financials.py
File Edit View Help

SEC Financial Statement Extractor

Download the source code and follow the set-up instructions to pull financial statements directly from the SEC website for any stock with one shortcut.

Step 1

1. Required Software

Ensure the following prerequisites are installed on your workstation:

■
Python (3.9+): Required to run and execute the data extraction engine.
■
Spreadsheet Application: Excel, Numbers, or Google Sheets to inspect the exported financial models.
■
Raycast (Optional): macOS launcher application required if you want to trigger the script with a single global keystroke without opening a terminal manually.
Step 2

2. Download the Files

Clone or download the repository directly from GitHub:

Required Project Files:
  • get_financials.py (main script)
  • my_headers.py (user-agent identity config)
  • requirements.txt (package dependencies)
  • scraper.command (optional Raycast launcher)
Step 3

3. Install Dependencies

Open a terminal window inside the downloaded project directory and install the required packages:

Terminal / Shell pip
pip install -r requirements.txt

This installs all necessary Python packages (requests, pandas, openpyxl, etc.) simultaneously.

Step 4

4. Add Your SEC User-Agent Info

The SEC EDGAR system requires every automated request to declare a custom User-Agent identifying the user (Name and Email). This is standard SEC practice:

Open my_headers.py and replace the placeholder with your own name and email address:

my_headers.py Python
headers = {'User-Agent': 'Your Name [email protected]'}

Save the file. You will not need to edit it again after this step.

Step 5

5. Run the Script

Launch the extraction script in your terminal:

Terminal / Shell Python 3
python get_financials.py

You will be prompted for a stock ticker (e.g., AAPL, MSFT, NVDA) and whether you want annual (10-K) or quarterly (10-Q) statements. The output Excel file automatically saves to a Company_Financials folder on your Desktop.

Step 6

6. Set Up a Keyboard Shortcut (Optional)

If you have Raycast installed on macOS, scraper.command lets you trigger the extraction pipeline from anywhere without touching a terminal:

  1. Open Raycast Settings → Extensions → click the + button → Add Script Directory, and select the folder containing scraper.command.
  2. Search for "Run SEC Scraper" in the Raycast search bar.
  3. Press ⌘K to open the Action Panel, choose Configure Command, select Record Hotkey, and record your desired shortcut.
Preview

Formatted Financials Within Seconds

Visual execution flow from terminal launch to structured financial tables in Excel:

Terminal output showing the scraper running
Terminal output while the script runs
Income statement Excel output
The resulting income statement in Excel
Document: get_financials.py
6 Steps
Python 3.9+
Ready