Skip to content

MT5 account data in Google Sheets or a web app

Updated 2026-11-28

Read it over HTTPS. FiveSocket hosts the MT5 terminal for your account and answers at https://api.fivesocket.com/v1, so Google Sheets can pull balance, equity, open positions and trade history with a short Apps Script, and a web app can do the same from its server. There is no file to export from MetaTrader, no Expert Advisor to install and no computer to leave on. Use an API key that can only read.

7-day free trial. Paid plans start at $9.99 a month. See pricing

Nothing to run
FiveSocket works without a Windows PC, a VPS or an open MT5 terminal, unlike MetaTrader 5's built-in MCP, which runs inside the desktop terminal and needs it running.
Price
From $9.99 a month for one MT5 account. Free to try for 7 days or 100 calls, whichever comes first, with no card.
Brokers
Any MT5 broker. You link an account with its login, password and exact server name.
REST and MCP
One linked account answers over a REST API at https://api.fivesocket.com/v1 and an MCP server at https://api.fivesocket.com/mcp, including prop status, bar-based backtests, a trade journal and execution with per-symbol maxVolume caps.
Prop firms
Prop firm MT5 accounts link the same way. An order guard checks each order against the daily loss and maximum loss limits of FTMO, FundedNext and The5ers programs, and the Prop plan is $19.99 a month for 3 accounts.

How it works

You link the MT5 account once with its login, password and exact server name. FiveSocket keeps a terminal session for it and returns live figures as JSON when you ask. Sheets and your web app are both just clients that make a GET request with an API key.

Reads a sheet or dashboard usually needs
RequestWhat it returns
GET /v1/accountsThe accounts you have linked, with their IDs
GET /v1/accounts/{accountId}/snapshotBalance, open positions and recent trades in one response
GET /v1/accounts/{accountId}/balanceBalance, equity, margin, free margin and currency
GET /v1/accounts/{accountId}/positionsOpen positions with volume, prices and stops
GET /v1/accounts/{accountId}/tradesClosed trades for a time window of up to 90 days
GET /v1/accounts/{accountId}/candlesCompleted broker candles for a symbol and timeframe

What you need

  • An MT5 login, its password, and the exact server name from your MT5 terminal. Any MT5 broker works, and the investor password is enough for reads.
  • A FiveSocket API key with the accounts:read and data:read scopes only. A sheet or dashboard never needs trading:execute.
  • A FiveSocket account. Link your MT5 account and try it free, no card: 7 days or 100 calls, whichever comes first. Then a 7-day free trial, card required. Cancel anytime. The trial includes one connected MT5 account.

Google Sheets with Apps Script

In the sheet, open Extensions, then Apps Script. Add a script property named FIVESOCKET_KEY that holds the key, paste the script and run refreshAccount. It writes the balance and the open positions to the first tab.

const BASE = "https://api.fivesocket.com/v1"

function fivesocket(path) {
    const key = PropertiesService.getScriptProperties().getProperty("FIVESOCKET_KEY")
    for (let attempt = 0; attempt < 6; attempt++) {
        const response = UrlFetchApp.fetch(BASE + path, {
            headers: { Authorization: "Bearer " + key },
            muteHttpExceptions: true,
        })
        const status = response.getResponseCode()
        if (status === 200) {
            return JSON.parse(response.getContentText())
        }
        if (status !== 202 && status !== 429 && status !== 503) {
            throw new Error("FiveSocket " + status + ": " + response.getContentText())
        }
        const headers = response.getHeaders()
        const wait = Number(headers["Retry-After"] || headers["retry-after"] || 5)
        Utilities.sleep(Math.min(wait, 30) * 1000)
    }
    throw new Error("FiveSocket did not answer in time")
}

function refreshAccount() {
    const accountId = fivesocket("/accounts").data[0].id
    const snapshot = fivesocket("/accounts/" + accountId + "/snapshot")
    const account = snapshot.balance
    const rows = [
        ["Balance", "Equity", "Free margin", "Currency", "Read at"],
        [Number(account.balance), Number(account.equity), Number(account.marginFree), account.currency, snapshot.observedAt],
        [],
        ["Symbol", "Side", "Volume", "Open price", "Current price", "Opened at"],
        ...snapshot.positions.map((p) => [p.symbol, p.side, Number(p.volume), Number(p.openPrice), Number(p.currentPrice), p.openedAt]),
    ]
    const width = 6
    const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0]
    sheet.clearContents()
    sheet.getRange(1, 1, rows.length, width).setValues(rows.map((row) => [...row, ...Array(width - row.length).fill("")]))
}
  • Money, prices and volumes arrive as decimal strings, so the script converts them with Number for formulas and charts.
  • A 202 response means the session is logging in to your broker. The script waits for the Retry-After delay and asks again.
  • To refresh on its own, add a time-driven trigger for refreshAccount under Triggers in Apps Script.

The docs version adds a tab of closed trades with paging, and the trigger setup step by step. Google Sheets recipe

A web app: call from your server

Keep the API key on your server and let the page ask your server. The key reads the whole account, so it must not ship to a browser, and the REST API does not accept cross-origin requests from pages on other sites. A server function like this one is all the page needs.

const base = "https://api.fivesocket.com/v1"

export async function accountView(accountId: string) {
    const response = await fetch(`${base}/accounts/${accountId}/snapshot`, {
        headers: { Authorization: `Bearer ${process.env.FIVESOCKET_KEY}` },
    })
    if (response.status === 202) {
        return { ready: false, retryAfterSeconds: Number(response.headers.get("retry-after") ?? "5") }
    }
    if (!response.ok) {
        throw new Error(`FiveSocket returned ${response.status}`)
    }
    const snapshot = await response.json()
    return {
        ready: true,
        observedAt: snapshot.observedAt,
        balance: snapshot.balance.balance,
        equity: snapshot.balance.equity,
        currency: snapshot.balance.currency,
        positions: snapshot.positions,
    }
}

It runs anywhere that has fetch: Node.js, Bun, Deno, a serverless function or an edge worker. The longer guide has a typed client with retries. MT5 API for Node.js

Limits

  • FiveSocket answers when asked. It has no price stream, WebSocket or webhooks, so a sheet or page shows the account as of its last request.
  • Each plan has a requests-per-minute limit per API key: Starter 60, Prop 90, Plus 120, Scale 300. A refresh every few minutes is far inside it.
  • The first request after the session has been idle logs in to your broker and can take several seconds.
  • There is no Google Sheets add-on and no JavaScript SDK. Both examples are plain HTTPS.
  • MetaTrader 4 accounts are not supported.

Frequently asked questions

Can Google Sheets read my MT5 account without a file export?
Yes. Apps Script calls the FiveSocket REST API with UrlFetchApp and writes the JSON into cells. Nothing is exported from MetaTrader and no Expert Advisor is involved.
Does my computer or MT5 terminal have to stay on?
No. FiveSocket hosts the MT5 terminal, and Apps Script runs on Google's servers. Your own MetaTrader can be closed.
Can I call the API straight from browser JavaScript?
No. The API key would be visible to every visitor, and the API does not accept cross-origin requests from other sites. Call it from your server and return only what the page needs.
How fresh is the data?
Each successful read comes from MT5 at the moment of the request, and the response carries observedAt so you can show when it was read. There is no push, so the sheet or page is as fresh as its last refresh.
Can the sheet place trades?
Not with a read-only key, which is what these examples use. Link the account with the investor password as well and MT5 itself refuses every order.
Which brokers work?
Every MT5 broker. You supply the exact server name from your MT5 terminal, and the brokers FiveSocket has already checked are listed on the brokers page.
How much does it cost?
Plans start at $9.99 a month for one MT5 account. Link your MT5 account and try it free, no card: 7 days or 100 calls, whichever comes first. Then a 7-day free trial, card required. Cancel anytime. The trial includes one connected MT5 account.

Try it on your own account.

Link your MT5 account and try it free, no card: 7 days or 100 calls, whichever comes first. Then a 7-day free trial, card required. Cancel anytime. The trial includes one connected MT5 account. Cancel before the trial ends and you are not charged. A demo account is the safest place to start.

7-day free trial. Paid plans start at $9.99 a month. See pricing