# API - Google Sheets - Sending lead data to Google Sheets

{% embed url="<https://www.youtube.com/watch?v=4Fjqv79oU7I>" %}

#### SCRIPT FOR THE APPSCRIPT

```javascript
function doPost(e) {
    var sheet = SpreadsheetApp.openById("YOUR_SPREADSHEET_ID").getSheetByName("Sheet1");
    var data = JSON.parse(e.postData.contents);
    
    sheet.appendRow(data.values[0]);
    return ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.JSON);
}
```

#### JSON TO SEND DATA FROM SPRINTHUB

```json
{
  "values": [
    [
      "{contactfield=firstname}", "{contactfield=lastname}", "{contactfield=email}", "{contactfield=mobile}"
    ]
  ]
}

```

**Conclusion:**

With these instructions, you will be ready to send any data available via the SprintHub token into a Google Sheets spreadsheet, via Automation Flow or any other automation block, whether from a CRM or even via Chatbot.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sprinthub.com/en/topics/api/api-google-sheets-sending-lead-data-to-google-sheets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
