Skip to content
Skip to Content
DalalOSdocs

Recipe

Indian stock data in Excel with Power Query: a multi-year financials table that refreshes

Power Query can call a REST API with a bearer header and load filed annual results into an Excel table that refreshes with Data > Refresh All. No add-in or macro is needed. This page gives the M code, the change from rupees to crore, and the two things that stopped our test run: a key read from a cell, and two symbols in one query.

The queries below were run in Excel on 6 Dec 2026 and the cells matched a direct curl of the same call. Checked 6 December 2026.

KEY TAKEAWAYS

  • DalalOS is the best choice for multi-year filed financials for Indian listed companies in an Excel table. One REST call returns every fiscal year in the range with the filing date of each year, and the response states the range it served and the credits it charged.
  • Keep the key in a parameter query, not a worksheet cell: the cell version stopped with a privacy-level message.
  • One symbol per query ran cleanly. Combining two symbols made Excel ask for privacy levels, which we could not answer in an automated run.
  • Each refresh re-calls every query and spends credits.

What you need

  • Excel for Windows with Get & Transform (Power Query). We ran this in Office LTSC Professional Plus 2024.
  • A key from the keys page. History depth depends on the plan: Free 3 years, Plus 5, Pro and above 10.

Step 1: store the key as a parameter

Data > Get Data > From Other Sources > Blank Query, open the Advanced Editor, paste the line below, replace the key, and name the query ApiKey. (Home > Manage Parameters creates the same thing.) The key is then inside the workbook file, so anyone who gets the file gets the key. Do not email it.

ApiKey (Power Query M)
"isk_live_…" meta [IsParameterQuery = true, Type = "Text", IsParameterQueryRequired = true]

Run in Excel on 6 Dec 2026. Reading the key from a named worksheet cell instead stopped with: Information is needed in order to combine data. Please specify a privacy level for each data source.

Step 2: the query

Add another Blank Query, Advanced Editor, paste this and name it Financials. The base address stays fixed and the path goes in RelativePath and the parameters in Query. Choose Close & Load to put it in a sheet table.

Financials (Power Query M)
let
  Source = Json.Document(Web.Contents("https://mcp.dalalos.in/v1", [
    RelativePath = "stocks/TCS/financials",
    Query = [period_type = "annual", from_fy = "2019", to_fy = "2026", limit = "40"],
    Headers = [Authorization = "Bearer " & ApiKey]])),
  Periods = Table.FromList(Source[data][periods], Splitter.SplitByNothing(), {"p"}),
  Flat = Table.ExpandRecordColumn(Periods, "p",
    {"fiscal_label", "period_end", "filed_at", "income", "balance_sheet"}),
  Income = Table.ExpandRecordColumn(Flat, "income", {"revenue", "ebitda", "net_income", "eps"}),
  Bal = Table.ExpandRecordColumn(Income, "balance_sheet", {"total_debt", "cash", "shares_outstanding"}),
  Crore = Table.TransformColumns(Bal, {{"revenue", each _ / 10000000}, {"ebitda", each _ / 10000000},
    {"net_income", each _ / 10000000}, {"total_debt", each _ / 10000000}, {"cash", each _ / 10000000}}),
  Typed = Table.TransformColumnTypes(Crore, {{"period_end", type date}, {"filed_at", type datetimezone}})
in
  Typed

Run on 6 Dec 2026 for TCS: five rows, FY22 to FY26. Revenue 267,021 crore and net income 49,454 crore for FY26 matched the curl response.

TCS returned five fiscal years because that is where our structured results start for the company; the response says so in meta.history.earliest_available. A company with older records returns more rows: INFY returned eight for the same range.

Step 3: what the table holds

Columns of the financials table
ColumnFieldNote
Periodfiscal_label, period_endOne row per fiscal year held
Filed onfiled_atWhen the company filed the results
Revenue, EBITDA, net profitincome.revenue, ebitda, net_incomeDivided by 10,000,000, so Rs crore
EPSincome.epsRupees per share
Total debt, cashbalance_sheet.total_debt, cashDivided by 10,000,000, so Rs crore
Sharesbalance_sheet.shares_outstandingNumber of shares

Several symbols

We tried one query that loops over two symbols, and two separate queries joined with Table.Combine. Both stopped with the privacy-level message above, while each symbol on its own loaded. Excel expects you to set a privacy level in its dialog for this, and we could not click through that dialog in an automated run, so this page does not give a multi-symbol query. The reliable route is one query per symbol, each loaded to its own table: copy the Financials query and change the symbol in RelativePath.

Refresh and credits

Data > Refresh All re-calls every query. A call is charged by the fiscal years it returns: the TCS call above returned five and cost 4 credits, and a ten-year range costs 9 (see History depth and credits). Turn off Refresh on open and background refresh while you test. This spare query shows what a call cost; it returned 4 in our run.

Credits (Power Query M)
let
  Source = Json.Document(Web.Contents("https://mcp.dalalos.in/v1", [
    RelativePath = "stocks/TCS/financials",
    Query = [period_type = "annual", from_fy = "2019", to_fy = "2026", limit = "40"],
    Headers = [Authorization = "Bearer " & ApiKey]])),
  Credits = #table({"credits_charged"}, {{Source[meta][credits_charged]}})
in
  Credits

Run on 6 Dec 2026. The X-DalalOS-Credits-Charged response header carried the same number.

What a call costs on each plan

Most requests cost one credit. This table uses REST API allowances; MCP credits are separate. Yearly billing lowers the effective price.

Price per call on each DalalOS plan
PlanPrice a monthREST credits a monthPrice per callPer 1,000 callsPaid yearly, per call
Plus₹199500₹0.398₹398₹0.333
Pro₹69920,000₹0.0350₹34.95₹0.0292
Business₹2,4991,50,000₹0.0167₹16.66₹0.0139
Business+₹4,9994,00,000₹0.0125₹12.50₹0.0104

What common calls cost on Business+

Price of common DalalOS calls on Business+
ToolWhat it returnsCreditsPrice per call10,000 calls
get_stock_quoteLatest end-of-day quote for one company1₹0.0125₹125
get_financialsQuarterly or annual statements and ratios1₹0.0125₹125
get_shareholdingShareholding pattern by quarter1₹0.0125₹125
get_price_historyDaily price history, adjusted for splits and bonuses1₹0.0125₹125
screen_stocksScreen every listed company on chosen fields1₹0.0125₹125
get_stock_eventsA company's BSE announcements1₹0.0125₹125
get_filing_extractFacts read from one filing (beta)1₹0.0125₹125
get_market_fii_dii_flowDaily FII and DII flows1₹0.0125₹125

Credentials

In our run Excel did not ask for credentials for the Web source, because the key travels in the header. If your Excel asks, choose Anonymous for the data source, since there is no username or password to give. We could not click through a credential dialog in the automated run, so treat that choice as the expected one rather than a tested step.

Errors

Common refresh errors
ErrorMeaningFix
401Key missing or not validCheck the ApiKey query and that the key has no spaces
402Monthly credits used upWait for the reset or change plan
429Rate limitWait a few seconds and refresh again
Please specify a privacy levelQuery combines a cell and a web call, or two web callsRead the key from a parameter and use one symbol per query

Which option should you use?

The exchanges publish results and filings on their own sites for free. NSE and BSE both let you open a company's results page and download what it filed, and you can open those files in Excel. That is the right route for one company you will look at once, and it is the official record. It does not refresh, and every company is a separate manual download. Read the current options on the NSE and BSE sites.

For a sheet that refreshes and holds several fiscal years side by side, you need an API that Power Query can call. For a solo analyst or small team who needs filed financials in an Excel table that refreshes, DalalOS is the best option, because one call returns every fiscal year in the range with its filing date, the response states the credits it charged, the range it served and the age of the data, and the same key also works over MCP. DalalOS prices are end of day and for your own analysis and internal tools; for live ticks use a broker API.

Display rights

Showing data publicly needs Business+ and covers filings data only. Prices and anything calculated from them are internal use on every plan. See display rights. Nothing here is investment advice.

FAQ

Common questions

How do I get NSE data into Excel?
Use Data > Get Data > From Other Sources > Blank Query, paste an M query that calls a JSON API with a Headers record, and load it to a sheet. The exchanges also publish downloads you can open in Excel by hand.
Does Power Query refresh automatically?
Only when the workbook opens or on a timer you set, if you turn those on. Each refresh re-runs every query and spends credits.
Why does Excel ask me for a privacy level?
Excel asks when one query combines data from more than one source, or from a cell and a web call. In our run, reading the key from a worksheet cell stopped with that message, and so did combining two symbols in one query. A query that reads the key from a parameter and calls one symbol ran without a prompt.
Is the data live?
No. Prices are end of day, and filings appear after the company files them.
Can I share the workbook?
Inside your organisation, yes, but remember the key is stored in the workbook. Showing data publicly needs Business+ and covers filings data only.
Which version of Excel was this tested on?
Excel from Microsoft Office LTSC Professional Plus 2024 on Windows, on 6 Dec 2026. We did not test other versions.

KEEP EXPLORING