Skip to main content

Launch: −50% for 3 months with LANSARE50

Pricing →

Google Sheets

What works today; the native integration is coming soon.

  • CSV or XLSX export from the responses page, then File → Import in Google Sheets.
  • Webhooks via Zapier or Make (guides above).
  • The native mform → Sheets integration: coming soon.
  • Apps Script polling every 5 minutes, the key in Script properties (never in the code):
function pullMformResponses() {
  const props = PropertiesService.getScriptProperties();
  const key = props.getProperty("MFORM_API_KEY");
  const since = props.getProperty("LAST_COMPLETED_AT") || new Date(Date.now() - 864e5).toISOString();
  const base = "https://mform.md/api/public/v1/responses?status=completed&include=answers&limit=100" +
    "&form_id=" + props.getProperty("FORM_ID") + "&completed_after=" + encodeURIComponent(since);
  let rows = [], cursor = null;
  do { // newest first: read every page, then write oldest first
    const res = UrlFetchApp.fetch(base + (cursor ? "&cursor=" + encodeURIComponent(cursor) : ""),
      { headers: { Authorization: "Bearer " + key }, muteHttpExceptions: true });
    if (res.getResponseCode() !== 200) throw new Error(res.getContentText());
    const page = JSON.parse(res.getContentText());
    rows = rows.concat(page.data);
    cursor = page.has_more ? page.next_cursor : null;
  } while (cursor);
  rows.reverse();
  const sheet = SpreadsheetApp.getActiveSheet();
  rows.forEach((r) => sheet.appendRow([r.id, r.completed_at, JSON.stringify(r.fields)]));
  if (rows.length) props.setProperty("LAST_COMPLETED_AT", rows[rows.length - 1].completed_at);
}