NZX Data in Google Sheets
7 custom functions for stock prices, governance scores, dividends, insider trading, and financials. All 130 NZX-listed companies. One script, no extensions to install.
Set Up in 2 Minutes
No add-on marketplace approval needed. Copy the script directly into your Google Sheet.
Copy the Script
Click the "Copy Script" button below to copy the entire Google Apps Script code to your clipboard.
Open Apps Script
In Google Sheets, go to Extensions > Apps Script. Delete any existing code in Code.gs and paste the NZXplorer script.
Set Your API Key
Save the script (Ctrl+S). Reload your spreadsheet. Click the NZXplorer menu > Set API Key and enter your key.
Use the Functions
Type =NZX_PRICE("FPH") in any cell. The function auto-completes and data appears. Results are cached for 6 hours.
7 Custom Functions
Each function auto-completes in Google Sheets. Results are cached for 6 hours to stay within Google quotas.
NZX_PRICE
Latest closing stock price in NZD.
=NZX_PRICE("FPH")35.20NZX_GRS
Governance Risk Score (0-100). Higher = better governance.
=NZX_GRS("FPH")82NZX_DSS
Dividend Safety Score (0-100). Payout ratio, FCF coverage, consistency.
=NZX_DSS("MEL")85NZX_ICS
Insider Conviction Score (0-100). Buy/sell ratio, director alignment.
=NZX_ICS("CEN")68NZX_DIVIDEND
Latest dividend per share in NZ cents.
=NZX_DIVIDEND("SPK")12.5NZX_FINANCIALS
Financial data by company, year, and field. Values in NZD thousands.
=NZX_FINANCIALS("FPH", 2024, "revenue")1856000NZXPLORER
Universal function. Fetches any metric: pe_ratio, roe, dividend_yield, debt_to_equity, market_cap, sector, and 40+ more.
=NZXPLORER("AIR", "pe_ratio")18.5Example: Stock Comparison Table
Build a live stock comparison table by combining multiple functions. Each cell fetches data independently and caches for 6 hours.
| Ticker | Price | GRS | P/E Ratio | Yield | DSS |
|---|---|---|---|---|---|
| FPH | =NZX_PRICE("FPH") | =NZX_GRS("FPH") | =NZXPLORER("FPH","pe_ratio") | =NZXPLORER("FPH","dividend_yield") | =NZX_DSS("FPH") |
| AIR | =NZX_PRICE("AIR") | =NZX_GRS("AIR") | =NZXPLORER("AIR","pe_ratio") | =NZXPLORER("AIR","dividend_yield") | =NZX_DSS("AIR") |
| MEL | =NZX_PRICE("MEL") | =NZX_GRS("MEL") | =NZXPLORER("MEL","pe_ratio") | =NZXPLORER("MEL","dividend_yield") | =NZX_DSS("MEL") |
| SPK | =NZX_PRICE("SPK") | =NZX_GRS("SPK") | =NZXPLORER("SPK","pe_ratio") | =NZXPLORER("SPK","dividend_yield") | =NZX_DSS("SPK") |
| CEN | =NZX_PRICE("CEN") | =NZX_GRS("CEN") | =NZXPLORER("CEN","pe_ratio") | =NZXPLORER("CEN","dividend_yield") | =NZX_DSS("CEN") |
40+ Available Metrics
Pass any of these as the second argument to NZXPLORER(). Example: =NZXPLORER("FPH", "roe")
Valuation
pe_ratiopb_ratioev_ebitdaprice_to_fcfprice_to_salesearnings_yieldProfitability
roeroanet_marginoperating_margingross_marginDividends
dividend_yieldpayout_ratiodpsdss_scoreLeverage
debt_to_equitycurrent_ratiointerest_covernet_debt_to_ebitdaGrowth
revenue_growthearnings_growthebitda_growthdividend_growthGovernance
grs_scoregrs_ratingboard_structure_scoreshareholder_rights_scoreInsider
ics_scoreCompany
pricemarket_capsectordescriptionFinancial Statement Fields
Use with NZX_FINANCIALS(ticker, year, field). Values are in NZD thousands.
Income Statement
revenuenet_profitebitdaebitoperating_expensesgross_profitBalance Sheet
total_assetstotal_liabilitiestotal_equitycash_and_equivalentstotal_borrowingsCash Flow
operating_cash_flowinvesting_cash_flowfinancing_cash_flowcapexfree_cash_flowTechnical Details
How the add-on works under the hood.
API-Powered
Calls the NZXplorer REST API (v1) at nzxplorer.co.nz/api/v1/ using UrlFetchApp. Authenticated via X-API-Key header. Same API used by the MCP server and Copilot.
6-Hour Cache
Uses CacheService.getScriptCache() to store API responses for 6 hours. A 50-cell spreadsheet makes at most 50 API calls on first load, then zero until cache expires. Clear manually via the NZXplorer menu.
Key in Script Properties
Your API key is stored in PropertiesService.getScriptProperties(), not in the spreadsheet. It is not visible to collaborators who have edit access but not Apps Script access.
Error Codes
| Error | Meaning | Fix |
|---|---|---|
| #NO_DATA | No data available for this ticker/metric combination | Check the ticker symbol and metric name are correct |
| #AUTH_ERROR | API key is missing, invalid, or expired | NZXplorer menu > Set API Key |
| #RATE_LIMIT | Too many API requests in the last minute | Wait 60 seconds and recalculate (Ctrl+Shift+F9) |
| #NOT_FOUND | Ticker not recognized or endpoint returned 404 | Verify the ticker is a current NZX-listed company |
| #INVALID_TICKER | Empty or non-string ticker argument | Pass a valid ticker string, e.g. "FPH" |
| #API_ERROR | Server error or network issue | Try again in a few minutes |
Frequently Asked Questions
How do I get an API key?
Sign up at nzxplorer.co.nz/auth and visit your account page. Free tier includes 10 API requests per minute, which is sufficient for most spreadsheet use. Pro ($29/mo) allows 100 requests/min for larger models.
How often does the data refresh?
Data is cached for 6 hours in Google Apps Script cache to stay within Google quotas. Use the NZXplorer menu > Refresh All Data to clear the cache manually. Stock prices update daily; financials update when companies file.
What companies are supported?
All 130 NZX-listed companies are supported. Use standard NZX ticker symbols: FPH, AIR, SPK, MEL, CEN, MFT, etc. The ticker is case-insensitive.
What does "NZD thousands" mean for financial data?
Financial statement values (revenue, profit, assets, etc.) from NZX_FINANCIALS are in NZD thousands, matching the standard NZ annual report convention. A value of 1856000 means $1,856,000,000 ($1.856 billion). Divide by 1000 if you want raw dollars, or multiply by 1000 if you want actual NZD.
Can I use this in Excel or other spreadsheet apps?
This add-on is designed for Google Sheets, which supports custom functions via Google Apps Script. For Excel, you can use the NZXplorer REST API directly with Power Query or Office Scripts. See the API documentation at /developers.
What happens if I exceed the rate limit?
Functions will return #RATE_LIMIT. The 6-hour cache means most spreadsheets make very few actual API calls. A sheet with 50 different formulas makes at most 50 calls on first load, then serves from cache. Wait 60 seconds and recalculate to retry.
Is the Insider Conviction Score (ICS) the same as on the website?
Yes. The ICS is computed from the last 30 insider trades using the same 4-component algorithm: buy/sell ratio (30pts), multi-director alignment (25pts), recency (25pts), and volume intensity (20pts). The calculation runs inside Google Sheets, so it works even without a premium API plan.
Ready to Add NZX Data to Your Spreadsheet?
Copy the script, set your API key, and start using NZX functions in under 2 minutes. Free tier supports 10 requests per minute.
Data sourced from publicly available NZX filings. Our datasets may not be complete. Automated analysis can produce errors. If you believe any data on this page is incorrect, please contact us at hello@nzxplorer.co.nz. For informational purposes only. Not investment advice.
