Skip to main content
All CollectionsAutomations
Automate Adding Prospects from Google Sheets to Saleshandy via API
Automate Adding Prospects from Google Sheets to Saleshandy via API

Guide to add prospects from google sheets to saleshandy via API

Naitik Chavda avatar
Written by Naitik Chavda
Updated over a week ago

Hello there, Saleshandy users! πŸ‘‹

​
Manually adding prospects from Google Sheets to your Saleshandy sequences can be time-consuming and tedious.


Luckily, we've found an easy way to automate this task without using any third-party tools. With just one API, a simple Google app script, and the sequence step ID, you can streamline this process efficiently.

Automatically add prospects to Saleshandy from your Google Sheet with an API

1. Obtain Your API Key

First, you need to get your API key from Saleshandy. Here’s how:

  1. Log in to your Saleshandy account.

  2. Go to Settings.

  3. Navigate to API Key and Click on Create Key.

  4. Provide a relevant label for your key. It'll generate the API Key and now you need to Copy the generated API key for use in the google app script.

2. Prepare Your Google Sheet

Ensure your Google Sheet is organized with all the necessary prospect details. Typically, you should have columns for FirstName, LastName, Email and any other relevant information.

3. Write the Script

Next, you need to write a Google Apps Script to handle the automation. Follow these instructions:

  1. Open your Google Sheet.

  2. Go to Extensions > Apps Script

  3. Delete any existing code and paste the following script:

Paste the below Script in App Script


function importProspectsToSaleshandy() {​
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = sheet.getDataRange().getValues();
var headers = data[0];
var prospects = [];
​ // Assuming the first row is the header and actual data starts from the second row
for(var i = 1; i < data.length; i++) {
var prospect = {
"fields": []
};
for(var j = 0; j < headers.length; j++) {
var fieldId = getFieldIdFromHeader(headers[j]);
if (fieldId) {
prospect.fields.push({
"id": fieldId,
"value": data[i][j]
});
}
}
prospects.push(prospect);
}
var payload = {
"prospectList": prospects,
"stepId": "your step id",
// You will replace this with your actual stepId, which you can find under your sequence and they will also be automatically added to the main prospects tab
​
"verifyProspects": false,
​
// If you also want the prospect to verify, write true instead of false

"conflictAction": "overwrite"
};​
var options = {
"method" : "post",
"contentType": "application/json",
"headers": {
"x-api-key": "your api key" // Add your api key here
},
"payload": JSON.stringify(payload)
};
var url = "https://open-api.saleshandy.com/v1/prospects/import";
var response = UrlFetchApp.fetch(url, options);
Logger.log(response.getContentText());
}
function getFieldIdFromHeader(header) {
​
​ // You have to replace the example IDs below with the actual field IDs from Saleshandy that matches with your sheets column header and you may add all the headers that you want to map with the Saleshandy prospect fields just make sure you don't add a comma for the last field. You can add more as well if you want but make sure Field Name is correct and ID you copied from Saleshandy is also correct.
​
var fieldMap = {
​
"First Name": "GlPYv8WvaV", // you will get this field if from settings>prospect fields>system fields
​
"Last Name": "LVPXoNWdwl", // you will get this field if from settings>prospect fields>system fields
​
"Email": "Y7PWZEW7wo" // you will get this field if from settings>prospect fields>system fields. If you want more fields ids add it below with the same formatting and it will be imported as well. Make sure you don't add a comma after the last field.
​
};
return fieldMap[header];
​}

  1. Replace 'YOUR_API_KEY' with the API key you generated earlier. Direct link to generate an API Key: Link

  1. Replace 'YOUR_STEP_ID' with the ID of the sequence step you want to add prospects to.

  2. Replace 'YOUR_FIELD_ID'With the data that you want to import into Saleshandy from Google Sheets. Direct link to find the Field ID: Link

  3. Save the script with a suitable name.

4. Run the Script

To execute the script:

  1. In the Apps Script editor, click on the Run button.

  2. Authorise the script to access your Google Sheets and external services if prompted

By following these steps, you can efficiently automate the process of adding prospects from Google Sheets to your Saleshandy sequences.
​


This straightforward solution leverages the power of Saleshandy's API and Google Apps Script to save you time and effort, making your workflow more seamless and productive.
​
Mission accomplished; you've successfully setup your data Automation . πŸ‘
​

Wishing you a delightful experience! ❀️

Happy Selling. 🀝

Warmest regards,

Saleshandy Team​

πŸ‘‰ Next Steps

Check out the below article If you want to know more about


πŸ’‘ Tip

Don't hesitate to reach out if you have any questions. We're available on chat and ready to provide you with prompt assistance. πŸ€—

Did this answer your question?