# Load a CSV or Google Sheet Into a Postgres Table by URL

**Use case:** 

Append every row of a public CSV, Excel, JSON file or Google Sheet (here the open ISO country-codes CSV on GitHub, 250 rows, 56 columns) into a Postgres table, creating it with one typed column per field. Ships as a dry run so Try needs no database: it shows the CREATE TABLE for all 56 columns. Add your connection string and turn Dry run off to load it; swap in your own file or sheet link.

## Input

```json
{
  "fileUrl": "https://raw.githubusercontent.com/datasets/country-codes/main/data/country-codes.csv",
  "data": [
    {
      "email": "ana@example.com",
      "name": "Ana Silva",
      "company": "Silva Ltd",
      "plan": "Pro",
      "mrr": 49,
      "active": true,
      "signedUpAt": "2026-08-01T09:30:00Z",
      "address": {
        "city": "Lisbon",
        "country": "PT"
      },
      "tags": [
        "b2b",
        "eu"
      ]
    },
    {
      "email": "ben@example.com",
      "name": "Ben Okafor",
      "company": "Okafor & Co",
      "plan": "Starter",
      "mrr": 19,
      "active": true,
      "signedUpAt": "2026-08-14T15:05:00Z",
      "address": {
        "city": "Lagos",
        "country": "NG"
      },
      "tags": [
        "b2b"
      ]
    },
    {
      "email": "cara@example.com",
      "name": "Cara Lind",
      "company": "Lind Studio",
      "plan": "Free",
      "mrr": 0,
      "active": false,
      "signedUpAt": "2026-09-02T11:00:00Z",
      "address": {
        "city": "Malmö",
        "country": "SE"
      },
      "tags": []
    }
  ],
  "fileFormat": "auto",
  "databaseType": "postgres",
  "sslMode": "auto",
  "tableName": "country_codes",
  "writeMode": "append",
  "keyFields": [
    "email"
  ],
  "createTableIfMissing": true,
  "addMissingColumns": true,
  "columnNaming": "snake_case",
  "flattenNested": true,
  "addSyncColumns": false,
  "batchSize": 500,
  "dryRun": true
}
```

## Output

```json
{
  "table": {
    "label": "Table",
    "format": "text"
  },
  "databaseType": {
    "label": "Database",
    "format": "text"
  },
  "mode": {
    "label": "Mode",
    "format": "text"
  },
  "dryRun": {
    "label": "Dry run",
    "format": "boolean"
  },
  "inputRecordCount": {
    "label": "Rows in",
    "format": "number"
  },
  "rowsWritten": {
    "label": "Rows written",
    "format": "number"
  },
  "rowsNotWritten": {
    "label": "Not written",
    "format": "number"
  },
  "tableCreated": {
    "label": "Table created",
    "format": "boolean"
  },
  "columnsAdded": {
    "label": "Columns added",
    "format": "array"
  },
  "uniqueIndexCreated": {
    "label": "Unique index created",
    "format": "boolean"
  },
  "batchesCompleted": {
    "label": "Batches",
    "format": "number"
  },
  "durationMs": {
    "label": "Duration (ms)",
    "format": "number"
  },
  "warnings": {
    "label": "Warnings",
    "format": "array"
  }
}
```

## About this Actor

This example demonstrates how to use [Dataset to Postgres, Supabase & MySQL (Database Push)](https://apify.com/nerolabs/dataset-to-database.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/nerolabs/dataset-to-database.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
This Task's input is already configured above — use it as-is rather than inventing a new one.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/nerolabs/dataset-to-database.md

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).
