n8n Workflow8 min setupNo code required

Automate Image to Excel (.xlsx) & Google Sheets in n8n

Send any JPG, PNG, or WebP table photo from a Form, Gmail, WhatsApp, or Google Drive trigger to POST /v1/image-to-excel, expand extracted rows in one Code node, and export clean Excel workbooks or Google Sheets rows automatically.

Printed JPG pricing schedule photo converted via StructOCR n8n workflow into structured Excel (.xlsx), CSV, and Google Sheets rows.
One n8n HTTP Request node sends the binary table image and returns clean headers and rows for Excel (.xlsx) or Google Sheets.

Why pair n8n with StructOCR POST /v1/image-to-excel

n8n excels at moving incoming attachments between WhatsApp, Gmail, Google Drive, Telegram, and spreadsheets—but it cannot read tabular rows out of a JPG photo or screenshot on its own. StructOCR's zero-retention POST /v1/image-to-excel endpoint accepts direct binary uploads up to 10 MB (no Base64 conversion step required) and returns rectangular headers[] and rows[][] arrays ready for Excel or Google Sheets. Want to skip manual setup? Download the ready-to-import n8n workflow JSON (n8n: Workflows → Import from File) with Form Trigger, HTTP Request node, row-expansion Code node, Convert to XLSX node, and Google Sheets append node.

Why photo tables stall n8n spreadsheets and ERP automations

Operations, finance, and field teams constantly receive pricing sheets, inventory counts, supplier quotes, and shift rosters as WhatsApp photos or email screenshots. Generic vision prompts often return inconsistent JSON keys or Markdown tables that break n8n's Google Sheets and Convert to File nodes whenever a supplier adds a column or leaves a cell blank.

Deterministic table arrays built for n8n Excel & Sheets nodes

StructOCR's Image to Excel OCR API (POST /v1/image-to-excel) guarantees that every row in document.tables[].rows matches headers.length with "" for empty cells—eliminating column drift inside n8n. You can test a photo in your browser first with our free Image to Excel converter, or review all parameters in the POST /v1/image-to-excel reference.

Build the n8n workflow (4 nodes)

  1. Add a trigger that outputs a binary image

    Start with any node that delivers a file under the Binary tab: n8n Form Trigger (file upload field), Gmail Trigger (Download Attachments enabled), Google Drive Trigger + Download File, or a Webhook receiving multipart photos. Note the binary property name (commonly data, image, or attachment_0).

    Supported formats: JPG, PNG, WebP (and scanned PDFs up to 20 pages) up to 10 MB. Works on smartphone photos, screenshots, and bilingual Arabic–English price sheets.
  2. Store your StructOCR API key as Header Auth

    In n8n Credentials, create a Header Auth credential. Set Name to x-api-key and Value to your StructOCR API key so your secret never gets hardcoded in exported workflow JSON.

    New accounts receive 200 permanent free credits (100 images at 2 credits/image) with no credit card required at structocr.com/register.
    Credential type: Header Auth Name: x-api-key Value: <your StructOCR API key>
  3. Configure the HTTP Request node for POST /v1/image-to-excel

    Add an HTTP Request node configured with POST https://api.structocr.com/v1/image-to-excel and Body Content Type Form-Data. Add a parameter of type n8n Binary File named file pointing at your trigger's binary field name. The endpoint defaults to mode=tables, so you immediately receive structured table arrays.

    Turn on Options → Response → Never Error if you want to route invalid files or quota errors to a Slack/Telegram alert via an IF node instead of halting batch runs.
    Method: POST URL: https://api.structocr.com/v1/image-to-excel Authentication: Generic Credential Type → Header Auth Send Body: On Body Content Type: Form-Data Parameter 1: n8n Binary File | Name: file | Input Data Field: image Parameter 2 (optional): Form Data | Name: mode | Value: tables
  4. Expand rows in a Code node and export to .xlsx or Google Sheets

    Paste the JavaScript snippet below into a Code node (Run Once for All Items). It maps every row in document.tables[] against its column headers into clean n8n JSON items. From there, attach Convert to File → Convert to XLSX (to generate a downloadable .xlsx workbook) and/or Google Sheets → Append Row with Map Automatically.

    For bilingual Arabic–English tables, n8n's XLSX and Google Sheets nodes preserve UTF-8 Arabic text automatically and StructOCR normalizes Eastern Arabic numerals (٠–٩) to standard digits.

Production n8n workflows you can ship in minutes

  • WhatsApp & Telegram supplier price sheets → Google Sheets: Field buyers forward photos of printed wholesale price lists; n8n extracts every SKU, quantity, and price into a live procurement sheet.
  • Gmail table screenshots → automated .xlsx email reply: Watch an operations inbox for attached PNG/JPG tables, convert them via StructOCR + n8n Convert to XLSX, and archive the workbook in Google Drive or OneDrive.
  • Bilingual UAE & Saudi Arabic–English sheets → ERP staging: Digitize Arabic–English inventory and quote photos without reversed RTL text—combining cleanly with our Arabic & Bilingual OCR API workflows.
  • Warehouse clipboards & stock sheets → Postgres / Airtable: Capture paper cycle-count tables with a phone form and upsert clean typed rows into Airtable or SQL without manual re-keying.

n8n Code node: expand extracted table rows for Excel & Google Sheets

Drop this into a <strong>Code</strong> node (Run Once for All Items, JavaScript) right after the HTTP Request node. Every table row becomes one structured n8n item ready for <strong>Convert to File (XLSX)</strong> or <strong>Google Sheets → Append Row</strong>.

Prerequisite: n8n Cloud or self-hosted n8n + a free StructOCR API key (200 permanent credits)

Method: POST
URL: https://api.structocr.com/v1/image-to-excel

Authentication: Generic Credential Type
Generic Auth Type: Header Auth
  Name: x-api-key
  Value: <your StructOCR API key>

Send Body: on
Body Content Type: Form-Data
Body Parameters:
  1. Parameter Type: n8n Binary File
     Name: file
     Input Data Field Name: data   (or 'image' / 'attachment_0')
  2. Parameter Type: Form Data (optional)
     Name: mode
     Value: tables

Options:
  Response → Never Error: on

Sample HTTP Request node output (Synthetic Example)

The HTTP Request node receives deterministic <code>document.tables[]</code> arrays alongside transparent credit accounting in <code>usage</code>.

{
  "success": true,
  "mode": "tables",
  "document": {
    "summary": {
      "document_type": "price_list",
      "title": "Pricing Schedule (Synthetic Sample)",
      "language": "en"
    },
    "fields": {},
    "tables": [
      {
        "id": "table_1",
        "title": "Pricing Schedule",
        "page_range": [
          1,
          1
        ],
        "stitched": false,
        "headers": [
          "SKU",
          "Description",
          "Qty",
          "Price"
        ],
        "rows": [
          [
            "SKU-101",
            "Steel Bracket",
            "24",
            "$18.50"
          ],
          [
            "SKU-102",
            "Hex Bolt Pack",
            "50",
            "$9.00"
          ],
          [
            "SKU-103",
            "Mounting Plate",
            "12",
            "$42.00"
          ]
        ]
      }
    ]
  },
  "custom_data": null,
  "pages": [
    {
      "page": 1,
      "status": "ok",
      "tables_found": 1
    }
  ],
  "usage": {
    "page_count": 1,
    "pages_processed": 1,
    "pages_succeeded": 1,
    "credits_per_page": 2,
    "credits_charged": 2
  }
}

Technical Specs

  • Endpoint: POST https://api.structocr.com/v1/image-to-excel with x-api-key header
  • Upload format: Direct binary multipart/form-data (file field, up to 10 MB; no Base64 node needed)
  • Accepted files: JPG, PNG, WebP (and scanned PDF up to 20 pages)
  • Privacy: Strict Zero Data Retention — images execute strictly in memory, raw_response: null in logs, zero AI training
  • Cost: 2 permanent credits per succeeded image/page; validation errors cost 0 credits and failed extractions refund automatically

Frequently Asked Questions

Does this n8n workflow require any paid community nodes?

No. It uses only built-in n8n nodes (Form Trigger or Gmail/Drive Trigger, HTTP Request, Code, Convert to File, and Google Sheets), so it works identically on n8n Cloud and self-hosted Docker instances.

Why does the HTTP Request node return NO_FILE in n8n?

Make sure the Body Parameter Name is exactly file, Parameter Type is n8n Binary File, and Input Data Field Name matches the exact binary key shown in the previous node's Binary tab (such as data, image, or attachment_0).

How do I output a downloadable .xlsx file instead of appending to Google Sheets?

Connect the Expand Table Rows Code node to n8n's built-in Convert to File node and select Operation: Convert to XLSX. You can then email the generated binary Excel workbook or upload it straight to Google Drive, SharePoint, or S3.

Can I also capture header fields above the table (like date or supplier name)?

Yes. Add a Form Data parameter mode=auto (and optionally schema with comma-separated field names) in the HTTP Request node. StructOCR will return both top-level metadata in document.fields and the grid in document.tables[].

Are images uploaded through my n8n workflow stored by StructOCR?

No. POST /v1/image-to-excel enforces strict zero data retention: image buffers are processed in memory only, never saved to audit storage buckets, and never logged in database payloads.

More Tutorials

Ready to Build with StructOCR?

Get your API key in under a minute. New users receive 200 free credits to test Passport, VIN, License Plate, Container, Receipt, HIN, Driver License, ID Card, Vehicle Registration, Weighbridge Ticket, ATM Cassette and Invoice OCR APIs.

✓ No credit card required · ✓ Instant API key · ✓ Full API access