Integrations

Import from Google Sheets to Kommo

The widget allows you to automatically load data from Google Sheets into Kommo and keep it up to date. Create new contacts, companies and leads. Changes are imported within a minute of table changes when setting up an Apps Script trigger.

Features

Automatically download data from Google Sheets
Create contacts, companies and leads
Import within a minute after table change (via Apps Script)
Backup periodic synchronization mode (every 10 minutes)
Flexible duplicate processing scenarios
Setting up working hours for import
Automatic tags for leads
Two-way synchronization with upload widget
Easy table format customization

Installation and setup guide

Detailed guide for working with widget "Import from Google Sheets to Kommo"

Basic settings

  • After installing the widget, go to Settings and click the +Add button.

Next, configure the import parameters:
Table link — insert a link to your Google Sheet.
Pipeline and stage — select the pipeline and stage where leads will be imported.
Working hours — specify the time range for import.
Lead tag — enter a tag that will be automatically added to leads during import.

  • Example of time settings: if you need to configure import from 23:00 to 10:00, add two ranges:
  • 23:00–23:59
  • 00:00–10:00
  • If you need to add another table for import, click +Add and configure it according to the same principle.
  • All tables will be taken into account simultaneously.
  • After completing the settings, click Save.

Processing takes

The Script for takes function is available in the settings:

  1. If the pipeline and title match (default) - the lead is updated if the pipeline (stage does not matter) and the lead name match.
  2. When a pipeline matches - the lead is updated when only the pipeline matches.
  3. Always create new - each import creates a new lead. When choosing this scenario, you must delete the Hash and lead ID in the table.
  4. Any lead found—The lead is updated if the contact or company already has at least one lead.

Setting up a table for import

Important: in the table access settings, specify “Anyone with the link can edit” or give access to our email: [email protected]

  • In the first line of the table the names of the columns are indicated
  • Format: Entity.Field name (for example: Lead.Name, Contact.Phone)
  • For more details, see link

Setting up Apps Script for Instant Import

To automatically import data when you change a table, you need to install a special Apps Script in your Google Sheet. This will ensure that changes are processed quickly (within a minute). Setup takes only 2 minutes - just paste the code and run one function!

Without Apps Script import will work in periodic check mode (every 10 minutes), which significantly slows down data synchronization.

Advantages of setting up a trigger:

  • Fast processing – changes are imported within a minute
  • 🔄 Automation – no need to wait for periodic synchronization
  • 💪 Data relevance – information in Kommo always corresponds to the table

💡Where can I find Account ID? In Kommo, click on your avatar at the top left → Your client number. This is your account_id.

Step-by-step instructions:

  1. Open your Google Sheet
  2. From the menu, select: Extensions → Apps Script
  3. Copy the code below and paste it into your editor (replacing all existing code)
  4. Run the setup function (select from the drop-down list and press ▶️)
  5. Return to the table sheet (located in the next tab) in the window that appears, enter your account_id (in Kommo: click on the avatar in the upper left → Your client number)
  6. Ready! Now changes in the table will be imported automatically
// 🚀 Initial setup function — run it once!
function setup() {
  var ui = SpreadsheetApp.getUi();
  
  // Ask the user for account_id
  var response = ui.prompt(
    '⚙️ Automatic import setup',
    'Enter your Account ID (in amoCRM: avatar top left → Your client number):',
    ui.ButtonSet.OK_CANCEL
  );
  
  if (response.getSelectedButton() !== ui.Button.OK) {
    ui.alert('❌ Setup cancelled');
    return;
  }
  
  var accountId = response.getResponseText().trim();
  if (!accountId) {
    ui.alert('❌ Account ID cannot be empty');
    return;
  }
  
  // Save account_id
  PropertiesService.getScriptProperties().setProperty('account_id', accountId);
  
  // Remove old triggers
  var triggers = ScriptApp.getProjectTriggers();
  for (var i = 0; i < triggers.length; i++) {
    if (triggers[i].getHandlerFunction() === 'onEdit') {
      ScriptApp.deleteTrigger(triggers[i]);
    }
  }
  
  // Create a new trigger
  ScriptApp.newTrigger('onEdit')
    .forSpreadsheet(SpreadsheetApp.getActive())
    .onEdit()
    .create();
  
  ui.alert(
    '✅ Setup complete!',
    'Account ID: ' + accountId + '\n\n' +
    'Now when the spreadsheet changes, data will be automatically imported into amoCRM within a minute.',
    ui.ButtonSet.OK
  );
}

// Returns spreadsheet timezone or UTC on error
function getSafeTimeZone() {
  try {
    var tz = SpreadsheetApp.getActiveSpreadsheet().getSpreadsheetTimeZone();
    return (tz && tz.trim()) ? tz : 'UTC';
  } catch(e) {
    return 'UTC';
  }
}

// ⚙️ Get account_id from settings
function getAccountIdFromProperties() {
  return PropertiesService.getScriptProperties().getProperty('account_id');
}

// 🔄 Main function — runs automatically when the spreadsheet is edited
function onEdit(e) {
  var accountId = getAccountIdFromProperties();
  
  if (!accountId) {
    Logger.log("❌ Account ID is not configured. Run setup()");
    return;
  }
  
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var activeSheet = e.source.getActiveSheet();
  var sheetId = activeSheet.getSheetId();
  var baseUrl = spreadsheet.getUrl();
  var fullUrl = baseUrl + "?gid=" + sheetId + "#gid=" + sheetId;
  
  var url = "https://qp1-nova.ru/api/events/gimport_market/" + accountId;
  var payload = {
    url: fullUrl,
    timestamp: (function() {
      var tz = getSafeTimeZone();
      var date = new Date();
      return new Date(Utilities.formatDate(date, tz, "yyyy/MM/dd HH:mm:ss")).getTime();
    })(),
    sheet_name: activeSheet.getName(),
    spreadsheet_id: spreadsheet.getId()
  };
  
  var options = {
    method: "post",
    contentType: "application/json",
    payload: JSON.stringify(payload),
    muteHttpExceptions: true
  };
  
  try {
    UrlFetchApp.fetch(url, options);
    Logger.log("✅ Import started for sheet: " + activeSheet.getName());
  } catch (error) {
    Logger.log("❌ Send error: " + error.toString());
  }
}

💡 Important: Installing Apps Script is recommended for all users of the widget. This ensures optimal data synchronization speed between Google Sheet and Kommo. If you have any questions about setup, please contact technical support.

Data transfer information

ℹ️The servers of this service (Google Sheets) are located outside the Russian Federation. If you process personal data of citizens of the Russian Federation, we recommend that you ensure compliance with the requirements of Federal Law No. 152-FZ “On Personal Data” regarding cross-border data transfer.