Skip to main content

How to Automatically Send Leads from Google Sheets to Grinfi

Written by Kate Korol
Updated over 10 months ago

This guide shows how to integrate Google Sheets with Grinfi using Google Apps Script, so that each new row added to your spreadsheet creates or updates a lead in a specific Grinfi list — no manual input needed.

🔗 What You’ll Need

  1. Grinfi API Key

  2. List UUID (list_uuid) – the Grinfi list where the lead should be added

  3. A Google Sheet with columns like:

    • First Name

    • Last Name

    • LinkedIn ID or Profile URL

    • Email

📘 Full API documentation is available here:

📄 Example Sheet Structure

First Name

Last Name

LinkedIn ID

Email

John

Doe

john-doe-123456

⚙️ Setting Up Google Apps Script

  1. Open your Google Sheet

  2. Go to Extensions → Apps Script

  3. Replace the contents with the following code (and insert your actual API key and list UUID):

    const GRINFI_API_KEY = 'Bearer YOUR_API_KEY';
    const LIST_UUID = 'YOUR_LIST_UUID';

    function onEdit(e) {
    const sheet = e.source.getActiveSheet();
    const editedRow = e.range.getRow();

    if (editedRow !== sheet.getLastRow()) return;

    const row = sheet.getRange(editedRow, 1, 1, 4).getValues()[0];
    const [firstName, lastName, linkedinId, email] = row;

    if (!linkedinId) return;

    const payload = {
    lead: {
    linkedin_id: linkedinId,
    first_name: firstName,
    last_name: lastName,
    email: email
    },
    list_uuid: LIST_UUID,
    update_if_exists: true,
    move_to_list: true
    };

    const options = {
    method: 'POST',
    headers: {
    'Authorization': GRINFI_API_KEY,
    'Content-Type': 'application/json'
    },
    payload: JSON.stringify(payload),
    muteHttpExceptions: true
    };

    const url = 'https://leadgen.grinfi.io/leads/api/leads/upsert';

    const response = UrlFetchApp.fetch(url, options);
    Logger.log(response.getContentText());
    }

🔄 How It Works

  • Every time a new row is added to your Google Sheet, the script triggers and sends the data to Grinfi.

  • If the lead already exists — it is updated.

  • If it’s new — it is created and added to the specified list.

📝 Notes

  • The linkedin_id field is required.

  • You can expand the payload to include more fields like company_name, position, or location if your sheet has them.

💬 Need Help?

Check out the Grinfi API docs or contact our support team — we’re happy to help.

Did this answer your question?