Integrations
Connect a Google Sheet to your leads
Send new form responses and existing sheet rows to YatraHQ with the supplied Apps Script.
Who can use this: Workspace administrators; Google Sheet editor access required
Open this workflow
- 1. Open Google Sheets
- 2. Rotate the existing key
On this page
- Prepare the sheet
- Install the script
- Understand ongoing sync
- Review dates and duplicates
- Worked example: backfill several tour tabs without losing history
- Read each row result before deciding what to retry
- Solve editor access and setup problems in the right order
- Prepare historical dates and source information
- Backfill verification checklist
- Check your result
- Troubleshooting
Prepare the sheet
Use a Google spreadsheet that you can edit. Each lead tab needs recognisable headers, including a usable phone/contact column. Name, city, destination, travellers, budget, and date columns help enrich enquiries. Phone-only rows can be imported; review their details later. Hidden tabs are skipped.
Install the script
- 1Open YatraHQ Settings → Google Sheets. Select Turn on sync, or Make a new key if replacing an existing script.
- 2Copy the generated script. It contains the workspace key, which is shown only when created.
- 3Open the Google Sheet → Extensions → Apps Script. Paste the supplied script into the project and save. Preserve unrelated code if this sheet already has scripts.
- 4Select setup from the function selector, run it, review the requested Google permissions, and authorise the script.
- 5Return to the sheet and check the YatraHQ status column on each lead tab. Verify a synced lead in the CRM.
Visual guide · Workflow
How a Sheet row reaches the CRM
Keep Google setup, row processing, and CRM verification separate.
Prepare the Sheet
Check visible tabs, contact headers, phones, and original dates.
Set up Apps Script
Use the supplied script and workspace key; run setup and authorise it.
Run sync
The timer runs every five minutes; a form trigger is attempted where supported.
Inspect the row result
Read Synced, Updated, Duplicate, or Skipped before deciding what to retry.
Verify in CRM
Search a representative enquiry and check workspace, source, and dates.
Actual Google Sheets settings component captured before enabling sync. No key was generated.
Locate this workflow using the page title and controls.Open full-resolution image ↗Understand ongoing sync
Setup performs an initial sync and installs a five-minute trigger. Form responses also use a form-submit trigger when available. Timed/manual sync sweeps the supported tabs; a form event uses its own tab. Large backfills run in slices and continue on later runs. Rows with a status are not resent automatically.
Review dates and duplicates
Recognised original lead dates help preserve historical reporting. Check dates and the workspace timezone after a backfill. Duplicate handling considers the normalised phone and trip interest, so the same person may have distinct enquiries for different trips. Read Synced, Duplicate, or Skipped results before assuming every row became a new lead.
Worked example · fictional people and illustrative amounts
Worked example: backfill several tour tabs without losing history
An agency has separate sheet tabs for Kashmir, Kedarnath, and general enquiries. Some rows contain only a contact number, city, destination, and an original enquiry date. The goal is to bring useful enquiries into the CRM while preserving their trip context and history, then continue receiving new rows. It is not to turn every old contact into a newly created enquiry dated today.
Start with one small tab and a few representative rows. Check headers, phone values, original dates, and whether the same person appears for more than one trip. Keep the sheet timezone and workspace reporting timezone in mind. The tab name is recorded as context through the sync workflow, but it does not replace checking the actual destination or package information.
- 1Confirm that you can edit the Google spreadsheet and that the intended lead tabs are visible. The script skips hidden tabs.
- 2Generate or rotate the workspace key in YatraHQ and copy the supplied script. Rotation invalidates the old key; update every script that was using it.
- 3Open Extensions → Apps Script, paste and save the script, choose setup, and authorise the required Google services after reviewing the permissions.
- 4Inspect the result for a few rows and open the matching CRM enquiries. Check the original creation dates, normalised phone, city, destination, group information, and notes before allowing a large backfill to continue.
- 5Review subsequent timer executions and the YatraHQ status column. Large histories can continue in slices rather than finishing in a single run.
Google Sheets Extensions menu captured without spreadsheet contact rows.
- 1. Open Apps Script
Read each row result before deciding what to retry
A status is also a processing marker. Ordinary sync skips rows that already have one. Do not repeatedly clear the entire status column simply because the total CRM lead count differs from the sheet row count. Some rows may be duplicates, updates, invalid contacts, or a separate trip for the same person.
| Sheet result | Meaning | Next check |
|---|---|---|
| Synced | A new lead was created | Verify workspace, trip context, and original date |
| Updated | A matched lead was enriched with missing information | Inspect the existing CRM record rather than search for a second new lead |
| Duplicate | A matching enquiry was found without a new record being needed | Review phone and trip context |
| Skipped: reason | The row was not accepted | Correct the stated row issue before retrying |
Visual guide · Key distinctions
Read the row status as a decision guide
Different outcomes require different checks.
Synced
A new enquiry was created. Verify the saved lead.
Updated
A match was enriched. Inspect the existing lead.
Duplicate
A match was found without a new record being needed. Check phone and trip context.
Skipped: reason
The row was not accepted. Correct the stated issue before retrying.
Use lead search and filters to check representative rows; customer records are excluded from this crop.
- 1. Add an enquiry
- 2. Import lead rows
- 3. Choose a pipeline view
Solve editor access and setup problems in the right order
If Apps Script opens a login loop or Google Drive error, solve account access before editing the YatraHQ code. Google documents issues with multiple signed-in accounts. Try a private window with only the account that owns or can edit the sheet. If the organisation blocks Apps Script, its administrator needs to review that restriction; a CRM key change will not fix a Google account policy.
After the editor opens, save the project and manually run setup once so the authorisation prompt can be shown. The script creates the five-minute trigger and attempts a form-submit trigger. A form-trigger error is caught so timed sync can continue. Review the execution log and installed triggers rather than assuming that one error means nothing is running.
Use syncNewLeads for an ordinary manual sync. The current script also provides resyncAll, which clears the processing statuses and revisits rows. Treat that as a deliberate reprocessing operation after reviewing the reason, the current script version, and a small test sample. It is not the first response to every discrepancy, and the matching/enrichment result still needs verification.
Visual guide · Workflow
Find the failure before retrying
Start at the first point where the expected evidence disappears.
Access
Can the right account open the service and intended workspace?
Connection
Is the integration active and linked to that workspace?
Record
Is this exact enquiry mapped, with usable contact and trip information?
Delivery result
Inspect the latest error and the result after a relevant retry.
Prepare historical dates and source information
Original enquiry dates affect the creation-date cohort in Intelligence. A recognised Date column can be interpreted as the lead date rather than a travel preference; review a sample to make sure the meaning is correct. Invalid, impossible, or future original dates should be investigated instead of silently treated as reliable history.
Source labels also affect reporting. The integration maps recognised workspace source labels and values, with a fallback when a source is not mapped. A destination tab or imported phone is not evidence that the enquiry came from Meta. Record the actual channel when it is known and avoid using a paid-ad source merely to make the reporting totals look complete.
Actual lead form with fictional values shows the information a team should confirm after an incomplete sheet row.
- 1. Confirm the budget
- 2. Record preferred travel dates
Backfill verification checklist
- One representative sample was checked before a large history was processed.
- Visible tabs have usable contact headers and phone values.
- Original dates and timezone interpretation are correct.
- Synced, Updated, Duplicate, and Skipped results are understood rather than counted as identical outcomes.
- New rows are arriving through the expected timer or form trigger.
- The current key and script are kept private, and rotation is coordinated across every connected sheet.
Check your result
The sheet shows row results, the expected enquiries appear in the right workspace, and Settings reports recent sync activity.
Troubleshooting
Apps Script opens an error or login loop
Google documents issues with multiple signed-in accounts. Try a private browser window signed in only with the sheet’s editor/owner account, then reopen Extensions → Apps Script. If access is denied by your organisation, ask its Google Workspace administrator.
Setup reports a form-trigger error
The supplied script catches that error and continues with five-minute sync. Read the execution log and verify the timer exists before expecting instant form delivery.
New rows are not arriving
Check script execution errors, the current workspace key, visible lead tabs, usable headers/phone values, row statuses, and the five-minute trigger. Rotated keys require a new script.




