Railway logo

Managed Postgres speaks PostgreSQL

Connect Railway to Excel, Sheets and AI

Railway Postgres over the public TCP proxy. Two variables look like the right one and only one of them is — the card knows which.

1connection
0inbound ports
read-onlyenforced

One connection, every surface

Where your Railway data can go

Connect Railway once and the same read-only connection feeds all of these — no second setup, no second copy of the data. 9 of 11 have a step-by-step guide.

Guide

Railway to Excel

Microsoft Excel · Excel add-in

Pull live Railway results straight into a worksheet and refresh them on demand — desktop Excel, Excel Online, Microsoft 365.

Read the PostgreSQL guide
Guide

Railway to Google Sheets

Sheets add-on

Run a saved Railway query from the sidebar and drop the rows into the sheet. Shared collaborators can refresh it themselves.

Read the PostgreSQL guide
Guide

Railway MCP server

Claude, Cursor and MCP clients

Give an AI assistant read-only access to Railway with the schema it needs to write correct SQL — no credentials in the chat.

Read the PostgreSQL guide
Guide

Railway REST API

HTTP endpoint

Publish a Railway query as an authenticated JSON endpoint any application can call, with an OpenAPI 3.1 spec and ready-made Postman, Insomnia and Hoppscotch collections. No database port is opened.

Read the PostgreSQL guide
Guide

Railway to Airtable

Automation platform

Sync Railway rows into an Airtable base on a schedule, or fetch them inside an Airtable automation script.

Read the PostgreSQL guide
Guide

Railway to Baserow

Automation platform

Feed a Baserow table from Railway over the REST endpoint — self-hosted or Baserow cloud.

Read the PostgreSQL guide
Guide

Railway to SeaTable

Automation platform

Keep a SeaTable base current with Railway data without exporting a file or exposing the database.

Read the PostgreSQL guide
Guide

Railway to Smartsheet

Automation platform

Push Railway results into a Smartsheet grid so plans and reports read from the source system, not last week's export.

Read the PostgreSQL guide
Guide

Railway to Anvil

Anvil Works · App platform

Back an Anvil Python app with Railway through the REST endpoint instead of embedding database credentials in the app.

Read the PostgreSQL guide
Supported

Railway to Power BI

Power Query M

Paste the generated Power Query M into the Power BI Advanced Editor and the report reads live Railway results over HTTPS — no ODBC driver, no database port opened.

How Power BI works no Railway walkthrough written yet
Supported

Railway alerts and reports

Slack · Discord · Email · Webhook

Put a Railway query on a schedule and have the rows delivered to Slack, Discord, email or a signed webhook — or hold the message until a row count, threshold or percentage change crosses the line you set.

How alerts and reports work no Railway walkthrough written yet

How it works

5 steps, no inbound firewall change

01

Install the Network Agent wherever suits you. It opens one outbound connection and never listens, so Railway sees an ordinary client and your network needs no inbound rule.

02

Open the Postgres service, go to the Variables tab, and copy DATABASE_PUBLIC_URL. That is the public one — DATABASE_URL is the private variable and will not work from outside Railway.

03

Paste it in. Host, port, database, username and password are read straight out of it.

04

Check the port came through. Railway assigns a proxy port per service and it is rarely 5432, so this is the field worth glancing at before you save.

05

Save. Microsoft Excel, Google Sheets, Power BI, MCP and REST all read through that one connection, or join it to your other sources in a single read-only statement.

Feature deep-dive

What Railway gives you

DATABASE_PUBLIC_URL, not DATABASE_URL

This is the single most common way a Railway connection fails, and it fails in the least helpful way possible.

  • Railway's private hostname ends in .railway.internal and resolves only inside Railway's own network. From anywhere else it does not resolve at all.
  • The agent runs outside Railway, so the private address is never reachable — the connection would simply hang rather than tell you why.
  • So the card rejects it outright and names the fix: use the public TCP-proxy host from DATABASE_PUBLIC_URL. That turns a silent timeout into a sentence you can act on.
  • The public proxy host ends in .proxy.rlwy.net. Older Railway deploys were issued .railway.app hostnames instead, and those still work if that is what your service has.

The port is per service, so nothing can guess it

Most managed Postgres services answer on 5432. Railway's proxy does not, and the card deliberately leaves the field empty.

  • Railway assigns a proxy port per service. Two databases in the same project will have different ones, and neither will be 5432.
  • The port field has no default for exactly that reason. An assumed 5432 would look filled in and then fail to connect, which is worse than an empty box.
  • Pasting DATABASE_PUBLIC_URL fills the port along with everything else, so the normal path never asks you to find it separately.
  • If you are typing the fields by hand, the port is the one to copy carefully — it is the field most likely to be wrong and the one that produces the least informative failure.

Self-signed certificates, and what encrypted means here

Railway's Postgres image ships a self-signed certificate, which decides how the agent handles TLS.

  • Use SSL is on by default and the connection is encrypted. The agent requires TLS rather than merely offering it.
  • The certificate chain is not verified. Full verification would reject Railway's self-signed certificate, so requiring encryption without validating the chain is the setting that actually matches the service.
  • Read that as protection against anyone reading the traffic on the way, rather than proof of what you reached.
  • There is no pooler in front of Railway Postgres and the card does not pretend otherwise — this is a direct connection over the proxy, with no pooled mode to choose.
-- Ordinary Postgres, read-only, over the public proxy
SELECT   c.name,
         COUNT(o.id)   AS orders,
         SUM(o.amount) AS revenue
FROM     public.customers AS c
JOIN     public.orders    AS o ON o.customer_id = c.id
WHERE    o.placed_at >= now() - interval '30 days'
GROUP BY c.name
ORDER BY revenue DESC;

Shared by every database connector

True of every database connector

  • Outbound only — the agent opens one encrypted connection out to Query Streams. No inbound port to forward, no VPN, no IP allowlist, nothing about your database exposed to the internet.
  • Credentials stay put — the database username and password live on the machine you installed the agent on. Query Streams never receives them and cannot reach your database on its own.
  • Read-only, enforced — one statement at a time, SELECT and friends only. A write is rejected on your own machine before it is ever sent to the server, rather than relying on a permission somebody remembered to set.
  • Deploy as many agents as you like — one per site, region or cloud. Every data source they can see arrives in a single dropdown, so nobody has to know which agent hosts what.

What you get once a query is saved

  • Share the capability, not the SQL — a colleague or an outside partner can run your query and change its filters without ever seeing the statement behind it.
  • Filters from either direction — declare them yourself as @variables, or let the connector spot the literal values already sitting in your WHERE clause and offer those as dropdowns.
  • Read it from anywhere — Microsoft Excel, Google Sheets, Power BI, the REST API, AI assistants over MCP, the Query Builder and Nova all read the same saved query.
  • Run several at once — five saved queries into five worksheet tabs, streamed concurrently, however large the results.
  • Join it to anything else you have connected — another database, a business API, or a folder of files, in one read-only statement.

Cross-source SQL

Join Railway to the rest of your data

One statement can span Railway and your other connections at once. Each source runs only the part it can, streams the result back, and the join happens centrally — the sources never talk to each other and nothing is copied anywhere.

3 connections · 3 agents

Railway Managed Postgres
Microsoft SQL Server Relational engine
Stripe Payments & billing

One statement

-- nothing copied, nothing merged, nothing scheduled
SELECT   c.region, COUNT(*) AS orders, SUM(i.amount_due) AS invoiced
FROM     railway_app.public.orders1 f
JOIN     erp_sql.dbo.customers2     c ON c.id = f.customer_id
JOIN     billing.stripe.invoices3   i ON i.customer = c.stripe_id
GROUP BY c.region
ORDER BY invoiced DESC;

The three parts are connection, schema and table — and the connection name is whatever you called it. Illustrative columns; your tables will be your tables. Read-only applies to every piece: SELECT, WITH and EXPLAIN only, with a ceiling on how much any one source may hand over for a single query. How federated queries work

Connection details

What Railway needs

Host
<name>.proxy.rlwy.net, the public TCP proxy. Older deploys on .railway.app also work
Port
Assigned per service by Railway. No default — it comes from DATABASE_PUBLIC_URL
Driver
Npgsql, carried by the agent — nothing to install at the Railway end
Paste format
DATABASE_PUBLIC_URL from the service Variables tab
Database
railway, which is Railway's default name for it
Username
postgres
TLS
Required, and forced by the agent for Railway hosts. Encrypted; the certificate chain is not verified, which is what Railway's self-signed certificate needs
Pooling
None. The agent applies no pooler adaptations for Railway
Not this card
The .railway.internal private hostname — the card rejects it and tells you which variable to use instead
Saved as
PostgreSQL, with Railway kept as a badge — there is no connection type called Railway
Default schema
public, which is what a federated reference carries

The private-versus-public variable is the whole story of this card. Railway shows DATABASE_URL prominently and it is the correct variable for services running inside Railway, which is most of what Railway is for. An external reader is the exception, and the exception needs the other variable. Rejecting the internal hostname by name — rather than letting it resolve to nothing and time out — is the difference between a five-second correction and twenty minutes of suspecting the firewall.

The empty port field is deliberate and worth defending. Every instinct says to prefill 5432 because almost every Postgres service uses it, but Railway's proxy assigns ports per service, so a prefilled 5432 would be confidently wrong. An empty required field asks a question; a wrong default answers it incorrectly and looks settled.

For a cross-source query Railway is ordinary Postgres. A connection you called railway_app is written railway_app.public.orders, and it joins to a folder of CSVs, an on-premises system of record or a billing API in one read-only statement — with nothing copied and nothing scheduled.

Vendor documentation: docs.railway.com

FAQ

Questions about Railway

Which tools can read Railway data through Query Streams?

All of them, from one connection: Excel, Google Sheets, MCP, REST API, Airtable, Baserow, SeaTable, Smartsheet, Anvil, Power BI, scheduled alerts and reports. Connect the database once and every surface reads the same read-only connection — there is no per-tool setup and no second copy of the data.

Do I have to open a firewall port to my Railway database?

No. The Query Streams Network Agent runs inside your network and opens a single outbound encrypted connection. Nothing listens for inbound traffic, no VPN is required, and the database keeps its existing firewall rules.

Can Query Streams change data in Railway?

No. The agent enforces read-only at the point of execution — one statement at a time, SELECT and friends only. Credentials stay on the agent and are never sent to Query Streams.

What does Query Streams need to connect to Railway?

A reachable host, a role and its password — the agent carries the driver, so nothing is installed on the database. Host: <name>.proxy.rlwy.net, the public TCP proxy. Older deploys on .railway.app also work. Port: Assigned per service by Railway. No default — it comes from DATABASE_PUBLIC_URL. Driver: Npgsql, carried by the agent — nothing to install at the Railway end. Paste format: DATABASE_PUBLIC_URL from the service Variables tab.

Can I join Railway to another database in the same query?

Yes — that is a federated query. One statement can reference Railway and your other connections at once, written as connection.schema.table. Each source runs only the part it can and streams the result back; the join happens centrally, so the sources never connect to each other and nothing is copied or scheduled. Read-only applies to every piece — SELECT, WITH and EXPLAIN only — and there is a ceiling on how much any one source may hand over for a single query. Federated queries are a plan feature; the federated queries page carries the current source and size limits.

Is connecting Railway different from connecting PostgreSQL?

Only the connection string. Railway speaks the PostgreSQL wire protocol, so filters, scheduling, sharing, the Excel and Google Sheets add-ons and the MCP server all behave identically. The Railway card pre-fills the host, port and SSL settings that provider expects.

Is there a Railway to Excel guide?

Yes — it is the PostgreSQL guide, and it is correct for Railway as written. Railway speaks the PostgreSQL wire protocol, so Railway to Excel, Railway to Google Sheets and every other destination follow the same steps. The only Railway-specific part is the connection string, and the Railway card fills that in for you.

Put Railway where the work happens

Install the agent, point it at your database, and pick a destination.

Read-only Outbound only Credentials stay on the agent