Google drive file name issue

Hi Everyone,

Could I get some help on my file name issue on google drive please?

Issue Summary

Aim:

I’m using a GPT-powered Personal Assistant workflow (v6, August 7) to save Tavily search results to Google Drive as a .txt file. The file name should be automatically generated based on the search topic or a heading in the Tavily answer.

What’s going wrong?

The file saves correctly with the full content, but the file name is always ‘Untitled’ instead of the dynamic name returned by the AI. The expected behaviour is that it should extract a title like “6 August emails.txt” or “Weather in London.txt” from the AI output.

Error Message or Unexpected Behavior: there is no error thrown by the Google Drive node itself.

But the expected file name is not applied. Instead of: “6 August Weather.txt”

The saved file appears as: Untitled.txt

Workflow logic:

The AI agent returns a valid JSON with fileName and fileContent

Google Drive node is set to Create file from text

File name expression used:

{{ $json.fileName || ‘WebSearch’ }}_{{ $now.format(“YYYY-MM-DD_HH-mm”) }}.txt

What’s happening:

The fileContent works perfectly — it includes full, formatted Tavily output.

But the fileName is not read, even though it exists in the JSON output from the GPT node.

Troubleshooting Tried:

Checked node credentials

Rebuilt the Drive node from scratch

Verified that GPT node returns fileName correctly

Tried both fileName and title fields

Ran test executions — confirmed fileName is in the JSON

Searched community posts

Verified fileContent mapping works

Switched from GPT-4 to GPT-4o

Tried fallback expressions like {{ $json.title }}

Even removed “File Name” field to test raw fallback behavior

Still stuck on: Dynamic file name not being applied even when present

Workflow Snippet:

Tool structure:

Tavily (tool node)

Personal Assistant (GPT Agent)

Google Drive (tool node) – “Create file from text”

GPT output:

{

“fileName”: “6 August emails.txt”,

“fileContent”: “Here are your last 3 emails:\n1. From Chloe…”

}

Google Drive node config: Mode: Create file from text

File Name:

{{ $json.fileName || ‘WebSearch’ }}_{{ $now.format(“YYYY-MM-DD_HH-mm”) }}.txt

File Content: {{ $json.fileContent }}

Output of the Last Node:

{

“fileName”: “6 August emails.txt”,

“fileContent”: “Here are your last 3 emails:\n1. From Chloe…”

}

But in Google Drive, the saved file shows: Untitled.txt

Environment Details:

n8n version: 1.104.1 (Cloud)

Database: Default (SQLite)

EXECUTIONS_PROCESS: Cloud (unknown, likely main)

Hosting method: n8n Cloud

OS: Cloud (n8n hosted)

Qustions:

Is this a bug in how tool output maps to file name in the Drive node?

How can I ensure the fileName field from GPT is correctly used?

Are there any known issues with tool node file name expressions in agent-triggered flows?

Thank you all for your help.


See the following example you could try:

{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        0
      ],
      "id": "f922abe5-2273-455e-9644-2ec759245ca6",
      "name": "When chat message received",
      "webhookId": "9f788560-af4c-404e-bbae-b0e5529746fd"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant, who can summarize texts and save summaries to Google Drive.\n\n# Tools:\n- Create File: use this tool to create a file to Google Drive.\n\n# Instructions:\n- when user submits a text, summarize it as an unnumbered list\n- create a meaningful short file name with 'txt' extension for the file with this summary\n- use Create File tool to store the summary to Google Drive with the name you thought of."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        208,
        0
      ],
      "id": "6d421ac9-39ff-4918-8dcb-75c148ef6554",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        80,
        208
      ],
      "id": "264f9048-a282-4096-8e5d-167fb7288437",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "KaC9RLJhAWVyQE8j",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "operation": "createFromText",
        "content": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('File_Content', `The summary of the text to store as file content.`, 'string') }}",
        "name": "={{ $fromAI(\"filename\", \"the name of the file to create in Google Drive\") }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDriveTool",
      "typeVersion": 3,
      "position": [
        368,
        208
      ],
      "id": "4bdf5035-e563-4cde-84b1-5744131fee46",
      "name": "Create File",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "6qPTH5ldV1hRKhEy",
          "name": "Google Drive Main account"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create File": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "instanceId": "9423335a0111216c302866f5fc1752af6da6042c706e1cc46ecd439bca874130"
  }
}

the log

the file:

as you can see the file is named Canada_Summary.txt, which is pretty decent.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.