← All N8N workflows
Data & databasesCodeExtract From FileFilterFormForm Trigger

append google sheets tool and receive form events and completion form

Configured with Extract From File, Filter, Form, Form Trigger, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
Data storeClient Usage LogGoogle Sheets ToolTransformLogging AttributesEdit FieldsTriggerOn form submissionForm TriggerCodeCustom LLM SubnodeCodeIntegrationDisplay JSON DocumentFormRoutingFilter Last MonthFilterData storeGet Client LogsGoogle SheetsTransformCalculate TotalsSummarizeTriggerEvery End of MonthSchedule TriggerMessagingSend InvoiceGmailTransformParse PDF UploadExtract From FileAI & modelsExtract Resume DataInformation Extractor

Node categories in this workflow

  • Data store
  • Transform
  • Trigger
  • Code
  • Integration
  • Routing
  • Messaging
  • AI & models

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
Client Usage LogData storeGoogle Sheets Toolappend
Logging AttributesTransformEdit FieldsSee node parameters
On form submissionTriggerForm TriggerSee node parameters
Custom LLM SubnodeCodeCodeSee node parameters
Display JSON DocumentIntegrationFormcompletion
Filter Last MonthRoutingFilterSee node parameters
Get Client LogsData storeGoogle SheetsSee node parameters
Calculate TotalsTransformSummarizeSee node parameters
Every End of MonthTriggerSchedule TriggerSee node parameters
Send InvoiceMessagingGmailSee node parameters
Parse PDF UploadTransformExtract From Filepdf
Extract Resume DataAI & modelsInformation ExtractorSee 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

Workflow notes

Update Workbook

Update Workbook

This is the workbook which will track the token usage and costs.

1. Offer AI Service to Clients

1. Offer AI Service to Clients

Here, we'll using an n8n form to offer a document extraction service for Resume/CV PDFs. The user simply uploads a PDF and we return it in JSON format. This is just a simple example for demonstration purposes.

2. Gather External Variables to Send to Log

2. Gather External Variables to Send to Log

There are some variables we can't define in the subnode but we can add them here.

3. Provide AI Service

3. Provide AI Service

Our service uses an LLM (OpenAI GPT4o-mini in this example) to organise the uploaded PDF's data into a structured JSON format. This conversion is useful for following integrations or data storage. In this example however, we'll use display it back to the user.

4. Use Custom LLM Subnode to Track Usage & Cost

4. Use Custom LLM Subnode to Track Usage & Cost

Learn more about the Langchain Code Node

By creating our custom LLM subnode using the Langchain Code node, we are able to tap into the chat completion's response which contains the token usage metadata for the information extractor request.

With this, we can calculate exactly how much the client's request is costing per use!

The only remaining step then is to store this data somewhere. Rather than importing more dependencies or hardcoding more credentials, a novel solution can be to attach a tool to our subnode.

Here, we've decided to use the Google Sheets tool and append the client's usage metrics to the sheet. Check it out here - Client Usage Log

5. Automatically Send Invoice at End of Month (Optional)

5. Automatically Send Invoice at End of Month (Optional)

With our client usage log, it's fairly simple to aggregate the log records for the client within a certain timeframe and calculate the totals. This can satisfy accurate billing requirements from clients or at least, allows your team to understand how much each client is costing and budget accordingly.

Try It Out!

Try It Out!

This n8n template demonstrates how to use the Langchain code node to track token usage and cost for every LLM call.

This is useful if your templates handle multiple clients or customers and you need a cheap and easy way to capture how much of your AI credits they are using.

How it works

  • In our mock AI service, we're offering a data conversion API to convert Resume PDFs into JSON documents.
  • A form trigger is used to allow for PDF upload and the file is parsed using the Extract from File node.
  • An Edit Fields node is used to capture additional variables to send to our log.
  • Next, we use the Information Extractor node to organise the Resume data into the given JSON schema.
  • The LLM subnode attached to the Information Extractor is a custom one we've built using the Langchain Code node.
  • With our custom LLM subnode, we're able to capture the usage metadata using lifecycle hooks.
  • We've also attached a Google Sheet tool to our LLM subnode, allowing us to send our usage metadata to a google sheet.
  • Finally, we demonstrate how you can aggregate from the google sheet to understand how much AI tokens/costs your clients are liable for.

Check out the example Client Usage Log - https://docs.google.com/spreadsheets/d/REPLACE_WITH_DOCUMENT_ID/edit?usp=sharing

How to use

  • SELF-HOSTED N8N ONLY - the Langchain Code node is only available in the self-hosted version of n8n. It is not available in n8n cloud.
  • The LLM subnode can only be attached to non-"AI agent" nodes; Basic LLM node, Information Extractor, Question & Answer Chain, Sentiment Analysis, Summarization Chain and Text Classifier.

Need Help?

Join the Discord or ask in the Forum!

SELF-HOSTED N8N ONLY

SELF-HOSTED N8N ONLY

Please note, this template only works in the self-hosted version of n8n only. It will not work in the cloud version.

append google sheets tool and receive form events and completion form

append google sheets tool and receive form events and completion form

Purpose and structure

This folder contains the append google sheets tool and receive form events and completion form workflow. Its executable nodes use code, extractFromFile, filter, form, formTrigger, gmail, googleSheets, googleSheetsTool, informationExtractor, scheduleTrigger, set, summarize. 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 form submission, Every End of Month

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/Filter/0830_Filter_Summarize_Send_Scheduled.json MIT; preserve source notices.

More in Data & databases