DEV Community

Cover image for Import a public Google Sheet while keeping identifiers as text
Tim Zinin
Tim Zinin

Posted on

Import a public Google Sheet while keeping identifiers as text

A product lookup table often contains values that look numeric but are identifiers: postal codes, account references or SKUs with leading zeros. An importer that eagerly converts every number-looking value can corrupt those identifiers before an application sees them. The safest starting point is a text-preserving snapshot with an explicit decision about type conversion.

Public Google Sheets to JSON reads permitted public CSV exports and returns one tab envelope. It does not authenticate to private sheets, edit cells, calculate formulas or select tabs by their display names. Each source URL identifies the export route and, when needed, a numeric gid.

Begin with a controlled public tab

The example uses the project's public control sheet from the installed input schema. inferTypes is false, so ordinary CSV strings remain strings. Use an equivalent tab that you own or are authorized to import when moving beyond the control example.

{
  "publishedCsvUrls": [
    "https://docs.google.com/spreadsheets/d/198Kd2vPvpEyCgYAJLmu53jW-uPaf6m6COkmv2stQzrM/export?format=csv"
  ],
  "headerRow": 1,
  "maxRows": 10000,
  "inferTypes": false
}
Enter fullscreen mode Exit fullscreen mode

The accepted URL shapes are Google Sheets export routes with format=csv and published CSV routes with output=csv. A URL that opens an editor or a login page is not interchangeable with a CSV download. A nonempty HTTP response can still be the wrong representation.

Keep record numbers alongside keys

headerRow refers to a one-based CSV record, which is different from a physical line in the downloaded bytes. A quoted multiline cell can span several lines while remaining one CSV record. Preserve the returned record numbers so a rejected value can be traced back to the source table.

The outer envelope contains headers and nested rows. Do not count every nested row as a separate tab result. If your application flattens the rows, retain the enclosing source URL, snapshot hash and ingestion identifier beside each record.

Opt into conversion deliberately

When inferTypes is enabled, the contract permits conservative decimal numbers and lowercase boolean values. Leading zeros, date-looking strings and unsafe integers remain strings. That conservative policy reduces accidental damage; it does not establish a schema for your business domain.

Validate required identifiers after import. For example, an SKU column might require nonempty strings and uniqueness. A date column may need an application-specific format and timezone. These are consumer rules, separate from whether the CSV itself parsed correctly.

Replace snapshots only after completeness checks

The Actor supports one through five source URLs and up to ten thousand nonempty data records per tab. A tab over the chosen cap can return a prefix for inspection while remaining partial. Do not overwrite a complete lookup table with that prefix.

A header-only or entirely empty CSV is a clean absence case. Login HTML, wrong MIME, malformed CSV and an exceeded bound are different outcomes. Keep their status records instead of collapsing every case into an empty list.

Stage an import before promotion

Write a complete candidate snapshot to a staging table, check its expected headers and identifiers, and then switch the application to that accepted version. If the source fails during a later refresh, preserve the previous accepted snapshot and expose the refresh failure separately.

This gives the sheet owner a simple editing surface while the application receives an auditable import. The important boundary is the promotion step: a fetched file is evidence for inspection, and a complete validated snapshot is what becomes the application's current lookup data.

Cost and verification scope

The current FREE-tier result price is $0.005 for the documented unit: One public Google Sheets tab converted to JSON rows. The current pricing record contains no separate start event. Discounted platform tiers have their own rates; inspect your applicable tier before estimating a batch. These are listing prices read on 21 October 2026, not a receipt or a claim about customer spending.

The contract for this draft was checked against installed build 0.1.3 (cNr8lCy6ADrkVvcnr). The input above is an illustrative schema example, not a newly executed run. Current source responses and useful output still need inspection when you choose to run it. No new cloud build or run was made to prepare this article.

Open the Actor and inspect its input and pricing.

AI-assisted draft; publication requires independent technical review.

Top comments (0)