Skip to content
Market closed · Wed, Nov 25 · 22:53 Brasília

PTAX in Excel and Google Sheets

Ready-made formulas to bring the Central Bank of Brazil PTAX and the spot dollar into your spreadsheet. The data comes from the Mesa do Dólar public API as CSV, with no key and no sign-up.

Google Sheets: IMPORTDATA

Paste the formula into an empty cell. The sheet downloads the CSV, splits the columns and fetches it again on its own from time to time.

Latest PTAX

=IMPORTDATA("https://mesadodolar.com.br/api/v1/ptax.csv?idioma=en", ",", "en_US")

Two rows: the header (date, buy, sell) and the latest day with a PTAX. Before 1 p.m. Brasília time, it is still the previous business day.

What the formula returns today
date,buy,sell
2026-11-25,5.8819,5.8825

Just the PTAX sell rate, in one cell

=INDEX(IMPORTDATA("https://mesadodolar.com.br/api/v1/ptax.csv?idioma=en", ",", "en_US"), 2, 3)

Row 2, column 3. Change the 3 to 2 for the buy rate.

PTAX for a date

=IMPORTDATA("https://mesadodolar.com.br/api/v1/ptax.csv?data=2025-12-31&idioma=en", ",", "en_US")

Date as YYYY-MM-DD. On weekends and holidays you get the previous business day, with its date in the first column.

Series since Jan 1, 2026

=IMPORTDATA("https://mesadodolar.com.br/api/v1/ptax/periodo.csv?de=2026-01-01&idioma=en", ",", "en_US")

Without "ate" (end date), the series runs up to the latest PTAX and gains a row every business day.

Fixed period: the year 2025

=IMPORTDATA("https://mesadodolar.com.br/api/v1/ptax/periodo.csv?de=2025-01-01&ate=2025-12-31&idioma=en", ",", "en_US")

Up to 400 business days per formula (about 19 months). For longer spans, one formula per period.

Spot dollar now

=IMPORTDATA("https://mesadodolar.com.br/api/v1/cotacao.csv?idioma=en", ",", "en_US")

Brasília date and time, spot dollar and the day’s change in %. While the session is open it is an estimate, because public B3 data arrives 15 minutes late; otherwise, the last session’s close. It is not the PTAX.

PTAX for every date in a list

For many dates (invoices, entries, contracts), pull the series once into a tab and look each date up there. One formula per row would mean one request per cell.

In a tab named Ptax, cell A1:

=IMPORTDATA("https://mesadodolar.com.br/api/v1/ptax/periodo.csv?de=2026-01-01&idioma=en", ",", "en_US")

In your tab, with the date in A2, the PTAX sell rate:

=VLOOKUP(A2, Ptax!A2:C, 3)

The approximate match (no fourth argument) returns the last business day up to the date. On weekends and holidays, that is the PTAX that applies.

Excel: Power Query (Get Data from Web)

1. On the Data tab, click Get Data > From Other Sources > From Web.

2. Paste the CSV address, for example the series above, and click OK.

3. In the preview, check File Origin 65001: Unicode (UTF-8) and Delimiter Comma. Click Load.

4. To bring in new days: Data > Refresh All. Under Query Properties you can refresh when the file opens or every few minutes.

The same query in the Advanced Editor

let
    Source = Csv.Document(Web.Contents("https://mesadodolar.com.br/api/v1/ptax/periodo.csv?de=2026-01-01&idioma=en"), [Delimiter=",", Encoding=65001]),
    Ptax = Table.PromoteHeaders(Source),
    Typed = Table.TransformColumnTypes(Ptax, {{"date", type date}, {"buy", type number}, {"sell", type number}}, "en-US")
in
    Typed

Data > Get Data > From Other Sources > Blank Query; open the Advanced Editor, paste the code and click Done. The columns come in as date and number.

Decimal comma or point

With idioma=en, the CSV uses commas between columns, a decimal point and YYYY-MM-DD dates, which is what the formulas on this page use. Without it (Portuguese, the default) or with idioma=es, it uses semicolons between columns, a decimal comma and dd/mm/yyyy dates.

In Google Sheets, the third IMPORTDATA argument ("en_US") says how to read the numbers. Without it, the spreadsheet locale applies (File > Settings).

The separator between formula arguments also follows the locale: comma in an English spreadsheet, semicolon in a Brazilian one. In a spreadsheet set to Brazil:

=IMPORTDATA("https://mesadodolar.com.br/api/v1/ptax.csv"; ";"; "pt_BR")

A number aligned to the left of the cell is text: the locale argument is missing or the CSV format does not match the spreadsheet.

Limits and good practice

No key and no sign-up. Up to 60 requests per minute per address.

One formula per series, not one per cell: pull the period into a tab and look the dates up there.

A period that has ended is cached for a day; one that runs to today, for 5 minutes; the spot dollar, for 1 minute.

The day’s PTAX is published shortly after 1 p.m. Brasília time.

Not for real-time trading: the spreadsheet decides when to fetch again.

When you publish, cite the source: Central Bank of Brazil, via Mesa do Dólar (mesadodolar.com.br).

Every address and parameter: public API. Today’s PTAX and its history: PTAX page.

Public data for reference, with no guarantee. Not investment advice.