← All N8N workflows
AI & researchCodeCryptoGmailGmail TriggerGoogle Sheets

Create spreadsheet and populate with headers and deal information

Configured with Crypto, Gmail, Gmail Trigger, Google Sheets, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
AI & modelsGenerate replyOpen AiTriggerOn email receivedGmail TriggerRoutingOnly continue forspecific emailsIfTransformConfigureEdit FieldsMessagingSend reply to recipientGmailTransformGenerate UUIDCryptoTransformThanks for yourresponse!HtmlCodeExtract message content(advanced)CodeRoutingIf spreadsheet doesn'texistIfRoutingSuccessfully created orupdated rowNo OpData storeCreate spreadsheetGoogle SheetsCodeStore spreadsheet IDCodeData storePaste dataGoogle SheetsRoutingIf no sheet IDsIfData storeCreate or update rowsGoogle SheetsCodeGet data from `Formatdata`CodeCodeGet data from `Formatdata` nodeCodeTransformFormat dataEdit FieldsRoutingSend email replyNo OpTriggerOn feedback givenWebhookData storeSend feedback forfine-tuned dataGoogle SheetsWeb / APIShow HTML pageRespond To WebhookCodeGet sheet IDs #1CodeRoutingIf no spreadsheet inconfiguration #2IfCodeStore specific sheetIDs #2CodeCodeGet sheet IDs #2CodeRoutingIf no spreadsheet inconfiguration #1IfCodeStore specific sheetIDs #1CodeTransformEmail templateHtmlRoutingRecord feedbackNo OpRoutingFallback routeNo OpTransformIdentify trigger #2Edit FieldsTransformIdentify trigger #1Edit FieldsRoutingDo not send unfinishedemail replyNo OpRoutingIf reply is completeIfRoutingDo not send email tothis recipientNo OpRoutingSend reply to databaseNo OpRoutingDetermine which triggerranSwitchRoutingIs text within tokenlimit?IfRoutingDo nothingNo Op

Node categories in this workflow

  • AI & models
  • Trigger
  • Routing
  • Transform
  • Messaging
  • Code
  • Data store
  • Web / API

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Generate replyAI & modelsOpen AiSee node parameters
On email receivedTriggerGmail TriggerSee node parameters
Only continue for specific emailsRoutingIfSee node parameters
ConfigureTransformEdit FieldsSee node parameters
Send reply to recipientMessagingGmailreply
Generate UUIDTransformCryptoSee node parameters
Thanks for your response!TransformHtmlSee node parameters
Extract message content (advanced)CodeCodeSee node parameters
If spreadsheet doesn't existRoutingIfSee node parameters
Successfully created or updated rowRoutingNo OpSee node parameters
Create spreadsheetData storeGoogle Sheetsspreadsheet
Store spreadsheet IDCodeCodeSee node parameters
Paste dataData storeGoogle Sheetsappend
If no sheet IDsRoutingIfSee node parameters
Create or update rowsData storeGoogle SheetsappendOrUpdate
Get data from `Format data`CodeCodeSee node parameters
Get data from `Format data` nodeCodeCodeSee node parameters
Format dataTransformEdit FieldsSee node parameters
Send email replyRoutingNo OpSee node parameters
On feedback givenTriggerWebhookSee node parameters
Send feedback for fine-tuned dataData storeGoogle Sheetsupdate
Show HTML pageWeb / APIRespond To WebhookSee node parameters
Get sheet IDs #1CodeCodeSee node parameters
If no spreadsheet in configuration #2RoutingIfSee node parameters
Store specific sheet IDs #2CodeCodeSee node parameters
Get sheet IDs #2CodeCodeSee node parameters
If no spreadsheet in configuration #1RoutingIfSee node parameters
Store specific sheet IDs #1CodeCodeSee node parameters
Email templateTransformHtmlSee node parameters
Record feedbackRoutingNo OpSee node parameters
Fallback routeRoutingNo OpSee node parameters
Identify trigger #2TransformEdit FieldsSee node parameters
Identify trigger #1TransformEdit FieldsSee node parameters
Do not send unfinished email replyRoutingNo OpSee node parameters
If reply is completeRoutingIfSee node parameters
Do not send email to this recipientRoutingNo OpSee node parameters
Send reply to databaseRoutingNo OpSee node parameters
Determine which trigger ranRoutingSwitchSee node parameters
Is text within token limit?RoutingIfSee node parameters
Do nothingRoutingNo OpSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • gmailOAuth2
  • googleSheetsOAuth2Api
  • openAiApi

Workflow notes

Configuration

Configuration

If you decide to use your own spreadsheet, it is up to you to ensure all columns are present before running this workflow. A good way to do this is to run this workflow once with empty spreadsheetid and worksheetId variables (see the Configure node). Then map the output from Store spreadsheet ID to this node.

It is recommended that you specify the spreadsheetId and worksheetId, since relying solely on a workflow's static data is considered bad practice.

spreadsheetId: The ID of the spreadsheet where Pipedrive deals will be stored. worksheetId: The ID of the worksheet where Pipedrive deals will be stored. spreadsheetName(required): The human readable name of the spreadsheet where Pipedrive deals will be stored. worksheetName(required): The human readable name of the worksheet in the spreadsheet where Pipedrive deals will be stored. recipients(required): Comma-separated list of email recipients to send ChatGPT emails to. Use * to send ChatGPT response to every email address. maxTokenSize(required): The maximum token size for the model you choose. See possible models from OpenAI here. replyTokenSize(required): The reply's maximum token size. Default is 300. This determines how much text the AI will reply with.

Create spreadsheet and populate with headers and deal information

Create spreadsheet and populate with headers and deal information

A spreadsheet is created if the spreadsheet does not exist. The spreadsheet ID is stored in the $getWorkflowStaticData('global') variable. Using Extract current deal node, the deal information is formatted for the sending to the new spreadsheet.

Tip: Deleting old spreadsheets

Tip: Deleting old spreadsheets

If you ever want to start over, delete the old spreadsheet, making sure that it is also deleted from Google Drive's trash.

`Get spreadsheet ID`

Get spreadsheet ID

The spreadsheet ID is stored in this workflow's static data. If you want to refresh the static data you will need to copy this entire workflow into a new workflow.

Sticky Note

If your workflow reaches this stage, you will need to consider increasing the tokens in Generate reply node.

Send a ChatGPT email reply when email received and save responses to Google Sheets

Send a ChatGPT email reply when email received and save responses to Google Sheets

This workflow sends a OpenAI GPT reply when an email is received from specific email recipients. It then saves the initial email and the GPT response to an automatically generated Google spreadsheet. Subsequent GPT responses will be added to the same spreadsheet. Additionally, when feedback is given for any of the GPT responses, it will be recorded to the spreasheet, which can then be used later to fine-tune the GPT model.

How it works

This workflow is essentially a two-in-one workflow. It triggers off from two different nodes and have very different functionality from each trigger.

On email received:

  1. Triggers off on the On email received node.
  2. Extract the email body from the email.
  3. Generate a response from the email body using the OpenAI node.
  4. Reply to the email sender using the Send reply to recipient node. A feedback link is also included in the email body which will trigger the On feedback given node. This is used to fine-tune the GPT model.
  5. Save the email body and OpenAI response to a Google Sheet. If a sheet does not exist, it will be created.

On feedback given:

  1. Triggers off when a feedback link is clicked in the emailed GPT response.
  2. The feedback, either positive or negative, for that specific GPT response is then recorded to the Google Sheet.
Sticky Note2

This workflow should never reach this node. It is only here for extending the functionality of this workflow if needed.

Sticky Note3

The email that was received is too large to process, as it exceeds token limit. See more on token limits.

Create spreadsheet and populate with headers and deal information

Create spreadsheet and populate with headers and deal information

Purpose and structure

This folder contains the Create spreadsheet and populate with headers and deal information workflow. Its executable nodes use code, crypto, gmail, gmailTrigger, googleSheets, html, if, noOp, openAi, respondToWebhook, set, switch, webhook. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

On email received, On feedback given

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/1653_Code_Webhook_Send_Webhook.json MIT; preserve source notices.

More in AI & research