DEV Community

ViewCourier
ViewCourier

Posted on Edited on

How to email an Airtable view as a CSV on a schedule (3 ways)

Disclosure: this article was written with the help of AI and checked against Airtable's docs and API before publishing.

A common Airtable request: "Every Monday at 8:00, email this view to my manager (or client, or accountant) as a CSV." Airtable lets you download a view as CSV by hand from the view menu. It does not let you schedule that download, and its automations cannot attach a CSV of a view to an email. So you need a workaround.

Here are three, from most hands-on to least.

Before you start: make an export view

Whatever method you pick, create a dedicated view for the export, for example Export - do not edit. Filter it to the rows the recipient should see, hide fields they shouldn't, and sort it the way people will read it. Every method below reads from that view.

Option 1: Airtable automation + script

Airtable automations have a scheduled trigger (At a scheduled time) and a Run script action. A script can read a view and build CSV text:

const table = base.getTable('Orders');
const view = table.getView('Export - do not edit');
// List the columns you want, in order. Scripting can't read which fields a view hides.
const fields = ['Order ID', 'Customer', 'Status', 'Total'].map((n) => table.getField(n));
const query = await view.selectRecordsAsync({ fields });

function cell(v) {
  let s = v == null ? '' : String(v);
  if (/^[=+\-@\t\r]/.test(s) && isNaN(Number(s))) s = "'" + s; // formula-injection guard
  return /[",\r\n]/.test(s) ? '"' + s.replace(/"/g, '""') + '"' : s;
}

const rows = [fields.map((f) => cell(f.name)).join(',')];
for (const r of query.records) {
  rows.push(fields.map((f) => cell(r.getCellValueAsString(f))).join(','));
}
const csv = '' + rows.join('\r\n'); // BOM so Excel reads UTF-8
output.set('rowCount', query.records.length);
Enter fullscreen mode Exit fullscreen mode

What this gets right:

  • selectRecordsAsync on a view applies that view's filters and sort, with no 100-record page limit.
  • getCellValueAsString gives the same text you see in the grid for linked records, lookups, dates and selects.
  • Values with commas, quotes or line breaks are quoted, and text starting with =, +, - or @ is prefixed so spreadsheets don't run it as a formula.
  • The leading  byte-order mark stops Excel on Windows from garbling accents.

Now the hard part: getting csv into an inbox as a file.

  • The built-in Send email action can't attach it. There is no automation action that turns text or records into a file attachment. Airtable's own support docs point to third-party tools for this.
  • Pasting records into the email body is capped. According to Airtable's support article on Find records, a list or grid of records inserted into an automated email shows at most 100 records. A view with 400 rows arrives with the first 100 and no warning.
  • So the script has to send the email itself. You fetch an email API (SendGrid, Mailgun, Postmark) and pass the CSV as a base64 attachment. That means a second account, an API key stored in your base, and your own error handling.
  • You maintain the column list. Add a field to the view and the CSV doesn't change until someone edits the script.
  • Scripts have time and memory limits, and Run script in automations requires a paid Airtable plan.

Good fit if: you're comfortable with JavaScript, already have an email API account, and the view is small and stable.

Option 2: Make or Zapier

The usual community answer. The scenario looks like this:

  1. Schedule trigger: every Monday at 08:00.
  2. Airtable: Search records in your export view. Set the record limit high enough and hope the view doesn't outgrow it.
  3. Iterator / aggregator to turn records into CSV text. Each column is mapped by hand.
  4. Create file from the text, with a file name and type.
  5. Gmail / Outlook / SMTP: send email with the file attached.

It works, and it's the right choice when the export is one step in a bigger workflow (export, then upload to SFTP, then post to Slack).

The costs to know about:

  • Operations add up per record. On Make, every record that passes through a module typically counts as an operation. A 2,000-row weekly export can use thousands of operations a month. Zapier's per-task billing has the same effect when you loop over records. Check your plan's quota before you build.
  • Manual column mapping, same as the script: new fields don't appear until the scenario is edited.
  • Edge cases are yours: quoting commas and line breaks, UTF-8 for Excel, Airtable's 100-records-per-page API paging and its limit of 5 requests per second per base.
  • The email comes from a connected mailbox, which ties the report to one person's login.

Option 3: A dedicated export service

Paid Airtable add-ons and third-party export or backup services exist that do only this job: send a view as a file to a list of recipients on a schedule, without you writing or maintaining a script. Compare them on a few points before you pick one:

  • Access scope: can you give it a read-only personal access token limited to the bases you choose?
  • Row limits: does it page through the whole view, and what happens when the view is larger than the plan allows?
  • File size: large CSVs may be zipped or replaced by a download link, so check how big files are handled.
  • Failure handling: what happens when a token is revoked or a view is deleted, and who gets told?
  • Price: many are subscription-based and charge by the number of exports or rows.

Good fit if: you want a fixed view delivered on a fixed schedule and would rather pay than maintain code.

Which one to pick

  • Small view, you like code, you already have an email API: the script.
  • The export is part of a larger workflow: Make or Zapier.
  • You just want "this view, as a file, in these inboxes, on this schedule": a dedicated third-party export service (Option 3).

Questions about any of the three approaches are welcome in the comments.

Top comments (0)