Ir al contenido
Empezar

Import into Postgres — CSV, Excel & PDF

Esta página aún no está disponible en tu idioma.

Goal: your users bring the file they have — CSV, Excel, even a PDF or a scan — and clean records land in PostgreSQL without leaving your product, and without you writing a mapping/validation UI. The pattern is the same every time: embed → validate → deliver. Mildport handles the first two; your webhook handler owns the PostgreSQL API call.

<mildport-import
api-base-url="https://imports.your-infra.example"
license-key="SIGNED_TENANT_KEY"
catalog-key="contacts"
></mildport-import>

2. Publish a catalog that mirrors PostgreSQL

Section titled “2. Publish a catalog that mirrors PostgreSQL”

The schema lives in a target catalog, not in host code. Create it in the catalog editor (/admin/catalogs on your engine, or embed <mildport-catalog-editor>), match the table you will insert into, and publish. The widget loads that published catalog by catalog-key.

Align field keys with column names (first_name, last_name, email, created_at). Mark every NOT NULL column required so the review step guarantees insertability before your INSERT or COPY runs.

Users then upload anything — renamed headers, six languages, XLSX/ODS, even PDF tables — and Mildport’s deterministic matcher plus the review step produce typed, validated rows.

Need the schema computed per user at runtime, or versioned with your app? That’s the schema-as-code path — pass targets from host code instead of catalog-key.

Clean rows arrive on your signed apply webhook; your handler feeds PostgreSQL:

INSERT … ON CONFLICT (email) DO UPDATE, or COPY FROM STDIN for large clean batches
  • let the importer own typing (dates, numerics, encodings) so COPY never dies mid-file on row 40,213.
  • wrap a batch in one transaction; use ON CONFLICT for idempotent re-delivery (webhook retries!).
  • keep NOT NULL columns aligned with required fields in the catalog — the review step then guarantees insertability.

psql \copy is great for YOU — not for your customers. An embedded importer gives end users mapping, validation and review, and your webhook handler receives rows that are guaranteed to satisfy the schema.


Try the flow first: the playground (no signup), then the Quickstart and target catalogs. Prices are published — hosted and flat-annual self-host — at mildport.com/#pricing.