How to Add a Chart to an n8n Workflow (Google Sheets to Slack)

4 min readChart-Output team

Want to see the output first? Render a chart in the playground. No account needed.

n8n is good at moving data between systems and has no opinion about drawing it. A Google Sheets node hands you JSON items. Slack and email want an image. The missing step is turning those items into a PNG.

This guide builds that step with two nodes and no extra infrastructure: a Code node that shapes your rows into a Chart.js-style config, and an HTTP Request node that sends the config to the Chart-Output render API and gets the image back.

What you'll build

text
Schedule Trigger → Google Sheets → Code → HTTP Request → Slack

Swap Google Sheets for Postgres, Airtable, HubSpot, or anything else that emits items. Only the Code node needs to know your field names.

Before you build anything, paste this into a browser. It renders a bar chart from the URL alone, with no key and no sign-up:

text
https://www.chart-output.com/api/v1/render?type=bar&labels=Jul,Aug,Sep,Oct&data=12400,15100,13800,17250&width=800&height=400

Anonymous requests like this are PNG only, capped at 1,200 pixels, and rate-limited per IP, so treat them as a preview. The workflow below uses an API key.

Before you start

  • An API key. Create one on the API Keys page. The Free plan needs no credit card and includes 1,000 renders a month.
  • Free plan limits you will notice. Charts carry a small chart-output.com footer mark, the longest edge is capped at 1,200 pixels, and output is PNG, JPEG, SVG, or WebP. PDF and the larger size cap are on paid plans. See pricing.

Step 1: Add the credential

In n8n, create a Header Auth credential:

  • Name: Authorization
  • Value: Bearer YOUR_API_KEY

Step 2: Shape the rows into a chart config

Add a Code node after your data node, set to Run Once for All Items:

javascript
const rows = $input.all().map((item) => item.json); return [ { json: { type: 'bar', width: 800, height: 400, format: 'png', data: { labels: rows.map((r) => r.Month), datasets: [ { label: 'Revenue', data: rows.map((r) => Number(r.Revenue)), }, ], }, }, }, ];

Change Month and Revenue to your column names. The Number() call matters: Google Sheets often returns cell values as strings, and a chart of strings comes out empty or flat.

The output is a single item holding the whole request body. If you report for several clients, add brandKitId here to apply a saved brand kit (colors, fonts, logo) to the chart.

Step 3: Render it

Add an HTTP Request node and set:

SettingValue
MethodPOST
URLhttps://www.chart-output.com/api/v1/render
AuthenticationGeneric Credential Type → Header Auth → the credential from step 1
Send BodyOn
Body Content TypeJSON
Specify BodyUsing JSON
JSON{{ JSON.stringify($json) }}
Options → Response → Response FormatFile

The last row is the one people miss. With Response Format set to File, the image arrives as binary data on the item, in a property named data by default.

Step 4: Send it

Slack. Add a Slack node, choose the File resource and the Upload operation, turn on Binary Data, and set the binary property to data. Pick a channel and run it. Menu labels shift a little between n8n versions, but the idea is the same: upload the binary the HTTP Request node produced.

Email. Attach the same binary property in the Gmail or Send Email node. For an inline chart in an HTML email, use a URL instead (next section) and see Chart.js charts in email for sizing and client quirks.

Want a URL instead of a file?

Add returnUrl: true to the object in the Code node and set the HTTP Request node's response format to JSON. The response is a hosted image URL:

json
{ "url": "https://..." }

Reference it in later nodes as {{ $json.url }}. This is the simpler path for chat messages and HTML emails, because nothing has to upload a file. Charts in Slack, Discord, and Teams covers how each destination handles image URLs.

While you are building: see what was fixed

Chart configs built in a Code node are easy to get slightly wrong. Add repair_mode: "safe" to the request and the response becomes a JSON envelope that includes image_url, repairs_applied, warnings, and normalized_config, so you can see exactly what the renderer changed. Remove it once the workflow is stable if you would rather have the plain image back.

Common problems

What you seeLikely cause
401The credential is missing, or the value does not start with Bearer (with the space).
402The monthly render allowance is used up.
403The plan does not allow the format or size you asked for. On Free, stay at 1,200 pixels or less and use PNG, JPEG, SVG, or WebP.
429Too many requests in a short time. Space the runs out.
Empty or flat chartValues are strings. Wrap them in Number().
Text or JSON where an image should beResponse Format is not set to File.

Limits worth knowing

  • Each render counts against your monthly allowance: 1,000 on Free, 25,000 on Pro.
  • A weekly report is a few renders a month. A per-user daily digest is not, so size the plan to the loop, not to the workflow.
  • The same pattern works in other tools. The Zapier and Make guide covers both.
  • Every field the render endpoint accepts is listed in the OpenAPI spec.

More from the blog