Airbnb revenue for a list of addresses in Google Sheets
Paste addresses into a sheet, select the rows, and each row gets revenue, nightly rate, occupancy, cash flow and a report link from the BNBCalc API.
Set up the sheet
Put one property per row, with headers in row 1: the address in column A, then bedrooms, bathrooms, guests and purchase price in columns B to E. The script fills in revenue, nightly rate, occupancy, cash flow and the report link in columns F to J, and writes any error in column K.
Add the script
In the sheet, open Extensions, then Apps Script, replace the code with the script below and save. In Project Settings, add a script property named BNBCALC_API_KEY with your API key as its value, then reload the sheet. Create a key in your BNBCalc settings if you don't have one.
Code.gs
const TIMED_OUT = "Timed out: check BNBCalc, then clear this to retry";
function onOpen() {
SpreadsheetApp.getUi()
.createMenu("BNBCalc")
.addItem("Analyze selected rows", "analyzeSelectedRows")
.addToUi();
}
function analyzeSelectedRows() {
const sheet = SpreadsheetApp.getActiveSheet();
const range = sheet.getActiveRange();
const key = PropertiesService.getScriptProperties()
.getProperty("BNBCALC_API_KEY");
const started = Date.now();
for (let row = range.getRow(); row < range.getRow() + range.getNumRows(); row++) {
// Apps Script ends a run at six minutes: stop between rows, not mid-request.
if (Date.now() - started > 4 * 60 * 1000) {
SpreadsheetApp.getActive().toast("Stopped after four minutes. Run it again for the rest.");
return;
}
const [address, bedrooms, bathrooms, guests, price, , , , , report, note] =
sheet.getRange(row, 1, 1, 11).getValues()[0];
// Each report is billed: skip rows that have one or may have one.
if (!address || report || note === TIMED_OUT) continue;
let response = null;
try {
response = UrlFetchApp.fetch("https://atlas.bnbcalc.com/v1/external/analysis/create/buy", {
method: "post",
contentType: "application/json",
headers: { "x-bnbcalc-api-key": key },
payload: JSON.stringify({
fullAddress: address,
bedrooms: bedrooms,
bathrooms: bathrooms,
accomodates: guests,
purchasePriceUSD: price,
}),
muteHttpExceptions: true,
});
} catch (error) {} // No answer: handled below.
const status = response ? response.getResponseCode() : 0;
// No answer or an ambiguous gateway error (502/503/504/524): the request
// may have reached the API and the report may have been created and billed.
if (status === 0 || status === 502 || status === 503 || status === 504 || status === 524) {
sheet.getRange(row, 11).setValue(TIMED_OUT);
continue;
}
let body = {};
try {
body = JSON.parse(response.getContentText());
} catch (error) {} // Not JSON, such as a proxy error page.
if (status >= 400) {
sheet.getRange(row, 11).setValue(status + ": " + String(body.message || "Request failed"));
continue;
}
const a = body.data;
sheet.getRange(row, 6, 1, 6).setValues([[
Math.round(a.yearOneRevenueUSD),
Math.round(a.ratePerNightUSD),
a.occupancyRatePercentage,
Math.round(a.yearOneCashFlowUSD),
a.url,
"",
]]);
}
}Run it
Select the rows to analyze and choose BNBCalc > Analyze selected rows. Google asks you to authorize the script the first time. Each report costs $0.20, and rows that already have a report link are skipped. To stay inside Apps Script's six-minute limit, a run stops after four minutes; run it again for the rest.
Why a menu and not a formula
A custom formula such as =BNBCALC(A2) looks simpler, but Google Sheets can rerun formulas when the sheet reopens or a cell changes, and each rerun would create, and bill, a new report. Custom formulas are also cut off after 30 seconds. A menu runs only when you choose it.
Airbnb API documentation, pricing, use cases, and comparisons
API Documentation
Endpoint reference with authentication, parameters, code examples, response examples, and error codes.
API Pricing
See what the BNBCalc API costs: $0 a month, $0.20 per report and $0.10 per AI step that completes.
API Use Cases
See how PropTech platforms, investors, lenders, operators, and analysts use the API in production workflows.
Data Coverage
Understand international property coverage, comparable-based estimates, location inputs, and where the API fits.
API Comparison
See how the BNBCalc API compares with AirDNA's API and other Airbnb data APIs on access, pricing model and output.
MCP server
Connect Claude, Cursor or VS Code to BNBCalc and run revenue estimates and deal analyses from your AI assistant.
MCP setup guide
Connect Claude, ChatGPT, Claude Code, Cursor or VS Code to the MCP server, step by step.
MCP reference
How the MCP server authenticates, every tool with its price, paid-tool approval and limits.
Changelog
What changed in the REST API and the MCP server, newest first.
Status
Live checks of the REST API and the MCP server.
Start building with the BNBCalc Airbnb Data API
Generate your API key, review the public docs, and add comparable-backed STR revenue analysis, full reports, and hosted report URLs to your product.