A free Python desktop application for Windows • Fetches live NSE stock prices via Yahoo Finance • Last updated: April 5, 2026
Stock Details Generator V2.0 is a free Python desktop application built with Tkinter that fetches live Indian stock prices from Yahoo Finance (via yfinance) and exports them to a beautifully formatted Excel workbook. Choose from Nifty 50, Nifty 200, or Nifty 500 indices — the constituent stock list is downloaded directly from NSE India at runtime, so no local CSV files are needed.
NEWMenu Bar — File → Open Config, Help → About for quick access
NEWconfig.json — All settings configurable via a JSON file (Excel path, retries, timeout, etc.)
NEWRetry Logic — Automatic retries with configurable delay on failed price fetches
NEWLogging — Detailed logging to stock_generator.log for debugging
Key Features
Live NSE Stock Prices — Fetches current prices for Nifty 50, 200, or 500 stocks via Yahoo Finance
Auto-Generated Excel Workbook — 10-column layout with stock names, sectors, prices, P&L formulas, and colour-coded cells
Progress Bar & Real-time Results — See fetch progress and stock prices as they come in
Non-blocking GUI — Network calls run in a background thread; the window remains responsive
Cancel Support — Abort a running fetch operation at any time
Configurable Settings — Edit config.json for Excel path, sheet name, retries, timeout, and more
Extra Save Paths — Save backup copies of the workbook to additional locations
PyInstaller Ready — Build a single standalone .exe for distribution
Excel Template Layout
The generated workbook (Share Analysis.xlsx, sheet Future Sight) has 10 columns:
Col
Header
Content
A
NSE Stocks
Company display name
B
CODE
Bare NSE ticker (e.g. HDFCBANK)
C
Sector
Pre-filled from NSE industry classification
D
Current Value
Price written here on every fetch
E
Share Quantity
Default 100 (edit freely)
F
Buying Amount
=D*E
G
Expected Price
Fill manually — your target sell price
H
Selling Amount
=IF(G="","",G*E)
I
Profit / Loss
=IF(F=0,"",H-F)
J
Profit / Loss %
=IF(F=0,"",((H-F)/F)*100)
Tip: The template is automatically recreated when you switch indices (e.g. Nifty 200 → Nifty 500), so all rows are always in sync with the fetched prices.
- Setup & Usage Instructions for Windows PC -
Prerequisites
Python 3.10 or later — Download from python.org. Make sure to check "Add Python to PATH" during installation.
pip — Comes pre-installed with Python. Used to install the required packages.
Internet connection — Required to download the NSE stock list and fetch live prices from Yahoo Finance.
Step 1 — Install Python
Download and install Python 3.10+ from the official site. During installation, make sure to check the box "Add Python to PATH".
Step 2 — Download the source files
Switch to the "Code" tab above and download both Python files:
Save both files to the same folder (e.g. C:\StockDetailsGenerator\).
Step 3 — Create a virtual environment (recommended)
Open Command Prompt or PowerShell, navigate to the folder, and run:
python -m venv .venv
.venv\Scripts\activate
Step 4 — Install dependencies
With the virtual environment activated, install the required packages:
pip install yfinance openpyxl requests
Step 5 — Create config.json (optional)
Create a config.json file in the same folder to customise settings. If you skip this step, the app will use sensible defaults. Example:
Step 6 — Run the application
Double-click StockDetailsGenerator.py or run from the terminal:
python StockDetailsGenerator.py
Step 7 — Select an NSE Index
In the GUI, use the dropdown to select Nifty 50, Nifty 200, or Nifty 500. Each option shows a description of how many stocks will be fetched.
Download the official constituent list from NSE India
Fetch the current price for every stock via Yahoo Finance
Write all prices to Share Analysis.xlsx on your Desktop
Step 9 — Monitor progress
The progress bar and results list update in real time. Each fetched stock and its price appears in the results panel. Use the Cancel button if you need to stop mid-fetch.
Step 10 — View results in Excel
Once complete, the app asks whether to open the Excel file. The workbook contains all fetched stock prices with pre-filled sectors, formulas for buying amount, selling amount, profit/loss, and profit/loss %.
Pro Tips
Start with Nifty 50 for a quick test (~50 stocks), then try Nifty 200 or 500 for broader coverage
The Excel template is auto-recreated when you switch indices, so you always get the correct number of rows
Use File → Open Config in the menu bar to quickly edit config.json
To build a standalone .exe, install PyInstaller and run: pyinstaller --onefile --noconsole --icon=stock_market.ico --name "StockDetailsGenerator V2.0" StockDetailsGenerator.py
Configuration Reference
Setting
Description
excel_file
Path to the Excel workbook (auto-created on Desktop if missing)
excel_sheet
Sheet name inside the workbook
stock_code_column
Column number (1-based) containing ticker codes
stock_price_column
Column number (1-based) where prices are written
extra_save_paths
Additional paths to save backup copies of the workbook
request_timeout
Seconds to wait for NSE/Yahoo Finance requests
max_retries
Retry attempts per stock on failure
retry_delay
Seconds between retries
log_file
Log file name for debugging output
Download Source Files
Download the Python source files and save them in the same folder