A mutual fund portfolio tracker in Google Sheets, from your CAS
Your Consolidated Account Statement (CAS) from CAMS or KFintech lists every mutual fund transaction under your PAN. This guide turns it into a Google Sheet that shows each fund's units, what you put in, what it is worth at today's NAV, the gain and the XIRR. No code: you copy one script.
1. Ask for your CAS
- Open the CAMS CAS page; it covers funds serviced by both CAMS and KFintech. The KFintech page works too.
- Pick Detailed (with transactions), a period starting 01-Jan-1990 so nothing is left out, and the email on your folios.
- Choose a password for the PDF and keep it. The PDF arrives by email in a few minutes.
2. Build the workbook
You need a free API key. Then, on the Sheets Lab, choose Import CAS statement and either:
- From your Gmail (easiest, can repeat every month): copy the Gmail script into Extensions → Apps Script of a new sheet, save and reload, then EJI API → Set API key and EJI API → Import my CAS from Gmail, typing the PDF password.
- Upload the PDF on the Sheets Lab page with its password, pick the tabs you want, copy the script, paste it in Extensions → Apps Script, save, reload, then run EJI API → Build my CAS workbook.
The PDF and its password are read in memory for that one request: nothing is stored or logged, and the PAN comes back masked.
3. What is in it
- Summary: schemes held, current value, net invested, gain, gain % and the XIRR of the whole portfolio.
- Holdings: one row per folio and scheme with the AMFI code, category, units, net invested (money in minus money out), latest NAV, current value, gain, gain % and XIRR, beside the statement's own units and cost value.
- Transactions: every row of the statement (date, type, amount, units, NAV), plus two formula columns: units added or removed, and the cash flow used for XIRR.
- Allocation: value by fund house and by category.
- Stocks: the shares and bonds you own through your funds, from their latest monthly portfolios, added up across funds.
- Statement check: units summed from the transactions against the closing balance the statement prints, scheme by scheme.
Every figure except the statement's own rows is a formula, so you can see how it is worked out. With Live NAV ticked, the NAV column is =EJI_MF_NAV(code) and refreshes from EJI API.
Summary!B5 =SUM(Holdings!K2:K21) current value of every fund Holdings!I2 =IFERROR(EJI_MF_NAV(C2),"") latest NAV by AMFI code Holdings!K2 =IF(I2="","",G2*I2) units × latest NAV
How the numbers are worked out
- Money in: purchases, SIPs, switch-ins and STP-ins, and fees. Money out: redemptions, switch-outs, STP-outs, SWPs and IDCW payouts. Reinvested IDCW and bonus units add units but no money.
- A switch counts as money out of one scheme and into another, so each scheme's gain and XIRR stand on their own, and the portfolio total is not counted twice.
- XIRR uses Google Sheets' own
XIRRover each scheme's dated cash flows, with today's value as the last one.
We tried it on a real statement
We ran the parser on a real CAMS detailed CAS covering 2017 to 2026: 8 fund houses, 12 folios, 35 schemes (20 still held) and 3,415 transaction rows, including 213 SIPs, 775 switch-ins, 211 STP-ins and 974 fee rows. Every row was read with no problems, and the Statement check matched the printed closing units for all 35 schemes. The investor's amounts are not shown here.
For developers
The workbook is built on one endpoint, which you can call yourself. See the CAS parser reference.
curl -H "x-api-key: YOUR_KEY" -F "file=@cas.pdf" -F "password=YOUR_CAS_PASSWORD" \ https://fin.ejiapi.com/api/mf/cas/parse
Related guides
Get Indian mutual fund NAV in Python
Latest NAV and NAV history into pandas.
Read the guideDownload a fund's full NAV history
Full history by scheme code or ISIN, month-end series, CSV.
Read the guideMutual fund NAV in JavaScript
Node.js 18+ with built-in fetch, no packages.
Read the guideOpen the Sheets Lab Get a free API key
Values, not advice. The workbook relies on what your statement prints; check the Statement check tab after each import.