8
n8n 中文网amn8n.com

自动化学术论文元数据及变量提取,从Gemini到Google Sheets

高级

这是一个Document Extraction, AI Summarization领域的自动化工作流,包含 39 个节点。主要使用 Set, Code, Wait, Gmail, Switch 等节点。 自动化学术论文元数据及变量提取,从Gemini到Google Sheets

前置要求
  • Google 账号和 Gmail API 凭证
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e4f10bef48753951b827b1628c136c25720855dd405c916d09e788211699198e",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "06ff1131-994f-47de-be13-6136cf9ecb04",
      "name": "XLS数据提取器",
      "type": "n8n-nodes-base.extractFromFile",
      "onError": "continueRegularOutput",
      "position": [
        -816,
        480
      ],
      "parameters": {
        "options": {},
        "operation": "xls",
        "binaryPropertyName": "={{ $('File Upload Trigger').item.binary.data0 }}"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "b053af46-c202-4217-8f06-a0e0c7a0f94b",
      "name": "CSV数据提取器",
      "type": "n8n-nodes-base.extractFromFile",
      "onError": "continueRegularOutput",
      "position": [
        -816,
        336
      ],
      "parameters": {
        "options": {
          "encoding": "utf-8"
        },
        "binaryPropertyName": "={{ $('File Upload Trigger').item.binary.data0 }}"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "fe2a68e9-b162-445e-ae46-aed72fe9559c",
      "name": "论文元数据提取器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -336,
        464
      ],
      "parameters": {
        "text": "={{ $json?.toJsonString ? $json.toJsonString() : JSON.stringify($json) }}",
        "options": {
          "systemMessage": "=You are given an article or snippet of text. Extract the following fields and return **only** a single JSON object in the exact structure below:\n\nFields to extract:\n- \"title\"\n- \"abstract\"\n- \"publication_date\"\n- \"source\"\n- \"authors\" (as an array of objects with a single key \"name\")\n\nOutput format (replace `string|null` with actual strings or `null`):\n{\n  \"authors\": [\n    { \"name\": \"string|null\" }\n  ],\n  \"title\": \"string|null\",\n  \"abstract\": \"string|null\",\n  \"publication_date\": \"date|null\",\n  \"source\": \"string|null\"\n}\n\nRules:\n- If any field cannot be found, set it to `null`.\n- For \"authors\", include an array of `{ \"name\": \"<author name>\" }` objects in the order they appear; if no authors are found, return an empty array `[]`.\n- Return **only** the JSON object with no extra text, comments, or markdown.\n\nValidation:\n- Use the output parser tool to check your output against the specified structure.\n- If validation fails, fix the JSON and re-emit the corrected JSON only."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "1a821473-3e90-4da7-817a-45916004c467",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -560,
        368
      ],
      "parameters": {
        "options": {},
        "batchSize": 10
      },
      "typeVersion": 3
    },
    {
      "id": "5eaa37da-ba8f-413e-9965-4a0e5981fa3d",
      "name": "创建电子表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1264,
        624
      ],
      "parameters": {
        "title": "={{ $json.chatInput }}",
        "options": {},
        "resource": "spreadsheet",
        "sheetsUi": {
          "sheetValues": [
            {
              "title": "Checkpoint"
            },
            {
              "title": "FinalResult"
            }
          ]
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "i2QQ5h70aiZ7H0s3",
          "name": "Google Sheets(owen)"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "9e79fe64-91f9-4a30-b684-af194ba194cf",
      "name": "读写数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        336
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Create spreadsheet').item.json.sheets[0].properties.title }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "i2QQ5h70aiZ7H0s3",
          "name": "Google Sheets(owen)"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.7
    },
    {
      "id": "0dd1e54a-3a1a-4da5-ab2d-9f8db38da89e",
      "name": "等待3秒。",
      "type": "n8n-nodes-base.wait",
      "position": [
        496,
        656
      ],
      "webhookId": "6606f055-dcfc-41a0-8c6b-4a3794d05969",
      "parameters": {
        "amount": 3
      },
      "typeVersion": 1.1
    },
    {
      "id": "2bc80873-54d9-400c-b6a4-762af5fe1fdf",
      "name": "结构化输出解析器1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -208,
        832
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"authors\": [\n    { \"name\": \"string|null\" }\n  ],\n  \"title\": \"string|null\",\n  \"abstract\": \"string|null\",\n  \"publication_date\": \"date|null\",\n  \"source\": \"string|null\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "8acb6ded-253b-409b-9e8b-004f4290a2a9",
      "name": "自动修复输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        -288,
        672
      ],
      "parameters": {
        "options": {
          "prompt": "Instructions:\n--------------\n{instructions}\n--------------\nCompletion:\n--------------\n{completion}\n--------------\n\nAbove, the Completion did not satisfy the constraints given in the Instructions.\nError:\n--------------\n{error}\n--------------\n\nPlease try again. Please only respond with an answer that satisfies the constraints laid out in the Instructions:"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "aa8da126-4765-480b-b1aa-94ad560cf6e3",
      "name": "数据格式化器",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        560
      ],
      "parameters": {
        "jsCode": "// 输入结构:items[i].json.output\n// 输出结构:[{ json: { authors: \"A; B; C\", title, abstract, publication_date, source } }]\n\nreturn items.map(item => {\n  const o = item.json?.output || {};\n  const authors = (o.authors || [])\n    .map(a => (typeof a === 'string' ? a : a?.name || ''))\n    .filter(a => a && a.trim())\n    .join('; ');\n\n  return {\n    json: {\n      authors: authors || null,\n      title: o.title || null,\n      abstract: o.abstract || null,\n      publication_date: o.publication_date || null,\n      source: o.source || null\n    }\n  };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8cc8c6ab-7f3a-4ddf-a146-d7db95c96896",
      "name": "Google Gemini 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -400,
        832
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "3nYhRpjFi2oGf30q",
          "name": "Gemini(owen)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3ea2219f-3ea4-4728-a055-4386d45e435e",
      "name": "保存到检查点表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        288,
        560
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "authors",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "authors",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "abstract",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "abstract",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "publication_date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "publication_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Create spreadsheet').item.json.sheets[0].properties.title }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "i2QQ5h70aiZ7H0s3",
          "name": "Google Sheets(owen)"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "14bc11af-a987-47e1-8bd5-a9f623cb208d",
      "name": "文件类型路由器",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1040,
        592
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "csv",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "16407fe1-c30c-4a81-b43e-6cdb44adc616",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ ( $('File Upload Trigger').item.json.files?.[0]?.fileExtension || '' ).toLowerCase() }}",
                    "rightValue": "csv"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "xls",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0f752545-ce9b-4906-8dce-6427a9b2cadd",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ ( $('File Upload Trigger').item.json.files?.[0]?.fileExtension || '' ).toLowerCase() }}",
                    "rightValue": "xls"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "xlsx",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "aab779cf-1bbf-4209-83b6-33d75f55cc86",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ ( $('File Upload Trigger').item.json.files?.[0]?.fileExtension || '' ).toLowerCase() }}",
                    "rightValue": "xlsx"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Error",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "60324888-4a08-4d20-988b-bc35176325be",
                    "operator": {
                      "type": "string",
                      "operation": "notExists",
                      "singleValue": true
                    },
                    "leftValue": "={{ ( $('File Upload Trigger').item.json.files?.[0]?.fileExtension || '' ).toLowerCase() }}",
                    "rightValue": "error"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "3b6cea37-8cf0-45e3-b15b-716e2aeec3c8",
      "name": "XLSX数据提取器",
      "type": "n8n-nodes-base.extractFromFile",
      "onError": "continueRegularOutput",
      "position": [
        -816,
        640
      ],
      "parameters": {
        "options": {},
        "operation": "xlsx",
        "binaryPropertyName": "={{ $('File Upload Trigger').item.binary.data0 }}"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "f1260b49-b8d7-4148-bac0-60010ae07c06",
      "name": "错误消息处理器",
      "type": "n8n-nodes-base.set",
      "position": [
        -816,
        784
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "78203b0f-a6cd-4bb9-a2bd-3b961a37428c",
              "name": "output",
              "type": "string",
              "value": "Pls attach a file"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ca176a9b-ae02-4afd-a50e-b11d1c37c311",
      "name": "文件上传触发器",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1488,
        624
      ],
      "webhookId": "e083cca5-1d57-4dea-93a3-7a4f90c6f833",
      "parameters": {
        "options": {
          "allowFileUploads": true,
          "allowedFilesMimeTypes": "text/csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "716b6a67-b194-4ea6-b24f-5cf9002e78c1",
      "name": "当被其他工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -1200,
        1184
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "GoogleSheetID"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "52ab0f2d-272b-4e57-b4b1-b6fc08550e40",
      "name": "学术变量提取器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        128,
        1248
      ],
      "parameters": {
        "text": "=academic paper:\n- {{ $json.Title }}\n- {{ $json.Abstract }}",
        "options": {
          "systemMessage": "=You are an academic research variable-extraction expert.\n\n## Task\nFrom the provided paper **Title** and **Abstract**, extract the following fields and output ONLY a single JSON object:\n\n## Strict Rules\n- Return ONLY the JSON object; no extra explanations or markdown.\n- Follow the Structured Output Parser JSON schema EXACTLY.\n- If a category has no items, return an empty array [].\n- Use ONLY the given Title/Abstract; do NOT fabricate.\n- Validate your JSON against the Structured Output Parser.\n\n## Output JSON Schema\n{\n  \"Summary\": \"string\",\n  \"DV\": [\"string\"],\n  \"IV\": [\"string\"],\n  \"Mediator\": [\"string\"],\n  \"Moderator\": [\"string\"],\n  \"Overarching_theory\": [\"string\"]\n}\n\n## Input example\n- Title:You’ve got mail! How work e-mail activity helps anxious workers enhance performance Outcomes\n- Abstract:Despite workplace anxiety being a common experience of daily work life that is increasingly reliant on technology, we lack knowledge of technology-based job demands that prompt its occurrence. Drawing on theorization on workplace anxiety and integrating literature on information and communication technologies, we consider telepressure and normative response pressure as internal and external between-person sources of daily workplace anxiety. We further present a model of how employees adaptively (vs. maladaptively) respond to workplace anxiety on days they experience workplace anxiety, where anxiety prompts: (a) work e-mail activity, a self-regulatory behavior facilitating performance outcomes; and (b) non-work e-mail activity, a behavior that disengages employees from their work, debilitating performance outcomes. Utilizing a multilevel, time-lagged experience sampling field study across 10 workdays (Level 1 N = 809; Level 2 N = 96), we identify telepressure as a significant contributor of daily workplace anxiety. Further, we found support for an adaptive function of workplace anxiety. On days employees experienced workplace anxiety, their personal initiative and citizenship behaviors were enhanced through behavioral regulatory activity manifested in work e-mail activity. This indirect effect was strengthened for employees perceiving higher (vs. lower) work e-mail centrality. This research advances understanding of the adaptive function of workplace anxiety, such that employees are active drivers of their daily experiences of workplace anxiety. \n## Output example\n```json\n{\n  \"Summary\": \"This study finds that “workplace anxiety” isn’t always a bad thing. When employees feel anxious due to email pressure, they actually become more proactive in completing tasks. However, if they switch to handling personal emails, their performance declines.\n\",\n  \"DV\": [\"Workplace Anxiety\"],\n  \"IV\": [\"Personal Initiative\", \"Citizenship Behaviors\"],\n  \"Mediator\": [\"Work e-mail Activity\", \"Non-work e-mail Activity\"],\n  \"Moderator\": [\"Work e-mail Centrality\"],\n  \"Overaching_theory\": [\"workplace anxiety theory\"]\n}\n```"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "9ed01cca-b185-4e4f-9a86-99691152a70d",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        304,
        1680
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"Summary\": \"string\",\n  \"DV\": [\"string\"],\n  \"IV\": [\"string\"],\n  \"Mediator\": [\"string\"],\n  \"Moderator\": [\"string\"],\n  \"Overarching_theory\": [\"string\"]\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e3e332f7-0805-4527-b466-226bc98e7e16",
      "name": "期刊等级分类器",
      "type": "n8n-nodes-base.code",
      "notes": "Parses input JSON, uppercases Journal, flags UTD24/FT50, computes Rank.",
      "position": [
        -96,
        1248
      ],
      "parameters": {
        "jsCode": "// ===== UTD24 & FT50 journal lists (UPPERCASE for matching) =====\nconst utd24 = new Set([\n  \"MANAGEMENT SCIENCE\",\n  \"MIS QUARTERLY\",\n  \"INFORMATION SYSTEMS RESEARCH\",\n  \"JOURNAL OF MARKETING\",\n  \"JOURNAL OF FINANCE\",\n  \"JOURNAL OF ACCOUNTING RESEARCH\",\n  \"JOURNAL OF ACCOUNTING AND ECONOMICS\",\n  \"JOURNAL OF POLITICAL ECONOMY\",\n  \"MARKETING SCIENCE\",\n  \"OPERATIONS RESEARCH\",\n  \"ORGANIZATION SCIENCE\",\n  \"JOURNAL OF CONSUMER RESEARCH\",\n  \"JOURNAL OF FINANCIAL ECONOMICS\",\n  \"THE ACCOUNTING REVIEW\",\n  \"STRATEGIC MANAGEMENT JOURNAL\",\n  \"ADMINISTRATIVE SCIENCE QUARTERLY\",\n  \"ACADEMY OF MANAGEMENT JOURNAL\",\n  \"ACADEMY OF MANAGEMENT REVIEW\",\n  \"REVIEW OF FINANCIAL STUDIES\",\n  \"JOURNAL OF INTERNATIONAL BUSINESS STUDIES\",\n  \"JOURNAL OF BUSINESS VENTURING\",\n  \"MANUFACTURING & SERVICE OPERATIONS MANAGEMENT\",\n  \"PRODUCTION AND OPERATIONS MANAGEMENT\",\n  \"MANAGEMENT INFORMATION SYSTEMS QUARTERLY\"\n]);\n\nconst ft50 = new Set([\n  \"ACADEMY OF MANAGEMENT ANNALS\",\n  \"ACADEMY OF MANAGEMENT JOURNAL\",\n  \"ACADEMY OF MANAGEMENT REVIEW\",\n  \"ACCOUNTING, ORGANIZATIONS AND SOCIETY\",\n  \"ADMINISTRATIVE SCIENCE QUARTERLY\",\n  \"AMERICAN ECONOMIC REVIEW\",\n  \"CONTEMPORARY ACCOUNTING RESEARCH\",\n  \"ECONOMETRICA\",\n  \"ENTREPRENEURSHIP THEORY AND PRACTICE\",\n  \"HARVARD BUSINESS REVIEW\",\n  \"HUMAN RELATIONS\",\n  \"HUMAN RESOURCE MANAGEMENT\",\n  \"INFORMATION SYSTEMS RESEARCH\",\n  \"JOURNAL OF ACCOUNTING AND ECONOMICS\",\n  \"JOURNAL OF ACCOUNTING RESEARCH\",\n  \"JOURNAL OF APPLIED PSYCHOLOGY\",\n  \"JOURNAL OF BUSINESS ETHICS\",\n  \"JOURNAL OF CONSUMER PSYCHOLOGY\",\n  \"JOURNAL OF CONSUMER RESEARCH\",\n  \"JOURNAL OF FINANCE\",\n  \"JOURNAL OF FINANCIAL AND QUANTITATIVE ANALYSIS\",\n  \"JOURNAL OF FINANCIAL ECONOMICS\",\n  \"JOURNAL OF INTERNATIONAL BUSINESS STUDIES\",\n  \"JOURNAL OF MANAGEMENT\",\n  \"JOURNAL OF MANAGEMENT INFORMATION SYSTEMS\",\n  \"JOURNAL OF MANAGEMENT STUDIES\",\n  \"JOURNAL OF MARKETING\",\n  \"JOURNAL OF MARKETING RESEARCH\",\n  \"JOURNAL OF OPERATIONS MANAGEMENT\",\n  \"JOURNAL OF POLITICAL ECONOMY\",\n  \"JOURNAL OF THE ACADEMY OF MARKETING SCIENCE\",\n  \"MANAGEMENT SCIENCE\",\n  \"MANUFACTURING & SERVICE OPERATIONS MANAGEMENT\",\n  \"MARKETING SCIENCE\",\n  \"MIS QUARTERLY\",\n  \"OPERATIONS RESEARCH\",\n  \"ORGANIZATION SCIENCE\",\n  \"ORGANIZATION STUDIES\",\n  \"ORGANIZATIONAL BEHAVIOR AND HUMAN DECISION PROCESSES\",\n  \"PRODUCTION AND OPERATIONS MANAGEMENT\",\n  \"QUARTERLY JOURNAL OF ECONOMICS\",\n  \"RESEARCH POLICY\",\n  \"REVIEW OF ACCOUNTING STUDIES\",\n  \"REVIEW OF ECONOMIC STUDIES\",\n  \"REVIEW OF FINANCE\",\n  \"REVIEW OF FINANCIAL STUDIES\",\n  \"SLOAN MANAGEMENT REVIEW\",\n  \"STRATEGIC ENTREPRENEURSHIP JOURNAL\",\n  \"STRATEGIC MANAGEMENT JOURNAL\"\n]);\n\n// ===== MAIN =====\nconst items = $input.all();\n\nreturn items.map(item => {\n  const data = item.json;  // 直接取当前 item 的数据\n  const journalUpper = (data.Source || '').toUpperCase().trim();\n\n  const isUTD24 = utd24.has(journalUpper);\n  const isFT50  = ft50.has(journalUpper);\n\n  let Rank = 'Not listed';\n  if (isUTD24 && isFT50) Rank = 'UTD24 & FT50';\n  else if (isUTD24) Rank = 'UTD24';\n  else if (isFT50) Rank = 'FT50';\n\n  // 直接修改原数据\n  data.Rank = Rank;\n\n  return { json: data };\n});\n"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "6dffab19-fc4b-4cce-98e2-f3b3df75f018",
      "name": "批处理器",
      "type": "n8n-nodes-base.splitInBatches",
      "notes": "Process items in batches.",
      "position": [
        -320,
        1248
      ],
      "parameters": {
        "options": {},
        "batchSize": 10
      },
      "notesInFlow": true,
      "typeVersion": 3
    },
    {
      "id": "815ae6d3-d485-4c22-be41-613e2e40104f",
      "name": "WOS字段映射器",
      "type": "n8n-nodes-base.set",
      "notes": "Map WOS fields to consistent keys for LLM.",
      "position": [
        -544,
        1248
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1fe90882-f72f-44b0-9957-1972abbc0b99",
              "name": "Authors",
              "type": "string",
              "value": "={{ $json.authors }}"
            },
            {
              "id": "3dcc8233-678c-4902-8cf4-41d051c8619c",
              "name": "Title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "82b3d148-7206-45e1-a98b-48c2f12110cf",
              "name": "Publication_date",
              "type": "string",
              "value": "={{ $json.publication_date }}"
            },
            {
              "id": "3557f70f-c27c-4880-81b8-661a3c6c490a",
              "name": "Source",
              "type": "string",
              "value": "={{ $json.source }}"
            },
            {
              "id": "c2978a5d-2583-4400-9556-a9967f07c535",
              "name": "Abstract",
              "type": "string",
              "value": "={{ $json.abstract }}"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "48078b19-e7e8-4ed5-91f6-2540df195daf",
      "name": "最终数据映射器",
      "type": "n8n-nodes-base.set",
      "position": [
        576,
        1248
      ],
      "parameters": {
        "options": {
          "ignoreConversionErrors": true
        },
        "assignments": {
          "assignments": [
            {
              "id": "3d64232b-c602-4bfa-867d-e19e6d5ee934",
              "name": "Authors",
              "type": "string",
              "value": "={{ $('Journal Rank Classifier').item.json.Authors }}"
            },
            {
              "id": "f05c2476-96fc-4edf-a06c-5a0e45026673",
              "name": "Title",
              "type": "string",
              "value": "={{ $('Journal Rank Classifier').item.json.Title }}"
            },
            {
              "id": "8a5667b9-8274-49fa-85a6-73b5cd440bd5",
              "name": "Publication_date",
              "type": "string",
              "value": "={{ $('Batch Processor').item.json.Publication_date }}"
            },
            {
              "id": "82c7191f-86de-4e4c-a242-655021a97fa4",
              "name": "Source",
              "type": "string",
              "value": "={{ $('Journal Rank Classifier').item.json.Source }}"
            },
            {
              "id": "5541b0bf-dbef-4724-a526-870ad9f08005",
              "name": "JournalRank",
              "type": "string",
              "value": "={{ $('Journal Rank Classifier').item.json.Rank }}"
            },
            {
              "id": "31c89435-c6b7-46c7-ab8b-b471b2c48f9d",
              "name": "AiSummary",
              "type": "string",
              "value": "={{ $json.output.Summary }}"
            },
            {
              "id": "f62c5f71-8219-420d-87ab-aba347f7673d",
              "name": "IndependentVariable",
              "type": "string",
              "value": "={{ Array.isArray($json.output.IV) ? $json.output.IV.join('; ') : $json.output.IV }}"
            },
            {
              "id": "5df47e1a-9772-4f42-bc7f-f4210cfa50cd",
              "name": "DependentVariable",
              "type": "string",
              "value": "={{ Array.isArray($json.output.DV) ? $json.output.DV.join('; ') : $json.output.DV }}"
            },
            {
              "id": "23f93176-157e-4e71-8c5f-29debc575297",
              "name": "Mediator",
              "type": "string",
              "value": "={{ Array.isArray($json.output.Mediator) ? $json.output.Mediator.join('; ') : $json.output.Mediator }}"
            },
            {
              "id": "655b398a-a201-45a5-becd-05f05ccaa567",
              "name": "Moderator",
              "type": "string",
              "value": "={{ Array.isArray($json.output.Moderator) ? $json.output.Moderator.join('; ') : $json.output.Moderator }}"
            },
            {
              "id": "4eaf14e2-bb55-459a-a31e-01d53393c979",
              "name": "Overaching_theory",
              "type": "string",
              "value": "={{ ($json.output.Overarching_theory || $json.output.Overaching_theory || []).join('; ') }}"
            },
            {
              "id": "46490da9-11af-4450-845e-5035e729842a",
              "name": "Abstract",
              "type": "array",
              "value": "={{ $('Journal Rank Classifier').item.json.Abstract }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "27414957-4c91-4ceb-8a3f-c0c31446f99a",
      "name": "读取检查点数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -768,
        1248
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Checkpoint"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Get Sheet id').item.json.ID }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "i2QQ5h70aiZ7H0s3",
          "name": "Google Sheets(owen)"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "8a66f6d9-8024-4f74-8e08-bc7ac8268671",
      "name": "保存最终结果",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        1248
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "cellFormat": "RAW"
        },
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "FinalResult"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Get Sheet id').item.json.ID }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "i2QQ5h70aiZ7H0s3",
          "name": "Google Sheets(owen)"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "1de00028-e39b-446d-9f18-db67380ce4d1",
      "name": "自动修复输出解析器1",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        208,
        1472
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b7ec38b4-5666-4c57-988c-f24dcfbc4e4e",
      "name": "等待3秒",
      "type": "n8n-nodes-base.wait",
      "position": [
        1024,
        1424
      ],
      "webhookId": "8d861ed5-69d4-480b-914c-1d312ad1ef37",
      "parameters": {
        "amount": 3
      },
      "typeVersion": 1.1
    },
    {
      "id": "faa63b27-907a-48e7-bb85-b30763f7827d",
      "name": "调用",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        704,
        336
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id}}",
          "cachedResultUrl": "/workflow/=%7B%7B%20$workflow.id%7D%7D"
        },
        "workflowInputs": {
          "value": {
            "GoogleSheetID": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
          },
          "schema": [
            {
              "id": "GoogleSheetID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "GoogleSheetID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "GoogleSheetID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "94cb61b6-0096-4820-aa67-c6939a3801e6",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2848,
        208
      ],
      "parameters": {
        "width": 704,
        "height": 784,
        "content": "# 🚀 快速开始"
      },
      "typeVersion": 1
    },
    {
      "id": "3b5ee089-b1a8-4824-b9bb-4e3cf6ceba0a",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1584,
        -192
      ],
      "parameters": {
        "color": 2,
        "width": 960,
        "height": 1168,
        "content": "## 1) 文件接收与类型路由"
      },
      "typeVersion": 1
    },
    {
      "id": "35cc183c-93f8-4b76-8fd6-b609c6dd53f0",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        -192
      ],
      "parameters": {
        "color": 3,
        "width": 1264,
        "height": 1168,
        "content": "## 2) 逐记录处理与元数据提取"
      },
      "typeVersion": 1
    },
    {
      "id": "3d10bbf2-50c8-4ac8-82a3-6fa848770ca3",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        1008
      ],
      "parameters": {
        "color": 5,
        "width": 720,
        "height": 832,
        "content": "## 3) 期刊排名与研究变量提取"
      },
      "typeVersion": 1
    },
    {
      "id": "88ab6929-3801-4134-857a-4faaefa7586a",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        1008
      ],
      "parameters": {
        "color": 5,
        "width": 2544,
        "height": 832,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b401df9b-f757-4c4c-91ec-2b4a27b74dcb",
      "name": "Send process notication",
      "type": "n8n-nodes-base.gmail",
      "position": [
        416,
        336
      ],
      "webhookId": "ec263e2e-8a0a-4e49-bb00-9e830b9ab59f",
      "parameters": {
        "sendTo": "your gmail",
        "message": "=🎉Metadata Normalization Workflow Done\n📖 write 【{{ $items('Read Write in Data').length ? Math.max(...$items('Read Write in Data').map(i => Number(i.json.row_number))) -1: null }}】 paper into checkpoint sheet\n🕓{{ new Date().toLocaleString(\"en-CA\", { timeZone: \"Asia/Singapore\", hour12: false }).replace(',', '') }}",
        "options": {},
        "subject": "🎉Metadata Normalization Workflow Done",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "jCTNCiXplqBJRbmj",
          "name": "Gmail(owen)"
        }
      },
      "executeOnce": true,
      "typeVersion": 2.1
    },
    {
      "id": "890dcae0-0417-4a2b-9267-7e1714a65f45",
      "name": "Send done notication",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -96,
        1072
      ],
      "webhookId": "ec263e2e-8a0a-4e49-bb00-9e830b9ab59f",
      "parameters": {
        "sendTo": "your gmail",
        "message": "=🎉Study Variable Extraction Workflow Done\n📖 Time to study\n🕓{{ new Date().toLocaleString(\"en-CA\", { timeZone: \"Asia/Singapore\", hour12: false }).replace(',', '') }}",
        "options": {},
        "subject": "🎉Study Variable Extraction Workflow Done",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "jCTNCiXplqBJRbmj",
          "name": "Gmail(owen)"
        }
      },
      "executeOnce": true,
      "typeVersion": 2.1
    },
    {
      "id": "07f67c54-ba3c-41c3-9133-649a9215bf48",
      "name": "便签说明5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2800,
        1168
      ],
      "parameters": {
        "color": 4,
        "width": 576,
        "height": 208,
        "content": "# Tips\nSince the workflow makes multiple LLM calls, to avoid unexpected interruptions that waste time and tokens, a `checkpoint` is used to temporarily store data. If Step 3 fails and the workflow stops, activate the `manual trigger`, disable `When Executed by Another Workflow`, and manually adjust `Read Checkpoint Data`(id) so it reads from the previously written `checkpoint` sheet and then continue the workflow.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "676d7e8c-d66a-4fb5-8c3d-6734e7604d26",
      "name": "manual trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "disabled": true,
      "position": [
        -1200,
        1376
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7b82e214-b931-4181-8018-63fdcc585c73",
      "name": "Get Sheet id",
      "type": "n8n-nodes-base.set",
      "position": [
        -992,
        1184
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9f2449d6-1013-4aa2-97b9-2e086903301b",
              "name": "ID",
              "type": "string",
              "value": "={{ $json.GoogleSheetID }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "75945c08-8b83-4bc2-9281-977a603ac9a7",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        96,
        1680
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "OBsJ1xTy5eLJvjhJ",
          "name": "Gemini(pixel)"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Wait for 3s": {
      "main": [
        [
          {
            "node": "Batch Processor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Sheet id": {
      "main": [
        [
          {
            "node": "Read Checkpoint Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for 3s.": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data Formatter": {
      "main": [
        [
          {
            "node": "Save to Checkpoint Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "manual trigger": {
      "main": [
        [
          {
            "node": "Read Checkpoint Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Processor": {
      "main": [
        [
          {
            "node": "Send done notication",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Journal Rank Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Read Write in Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Paper Metadata Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Type Router": {
      "main": [
        [
          {
            "node": "CSV Data Extractor",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "XLS Data Extractor",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "XLSX Data Extractor",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Message Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WOS Field Mapper": {
      "main": [
        [
          {
            "node": "Batch Processor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Final Data Mapper": {
      "main": [
        [
          {
            "node": "Save Final Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CSV Data Extractor": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create spreadsheet": {
      "main": [
        [
          {
            "node": "File Type Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Write in Data": {
      "main": [
        [
          {
            "node": "Send process notication",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Final Results": {
      "main": [
        [
          {
            "node": "Wait for 3s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "XLS Data Extractor": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Upload Trigger": {
      "main": [
        [
          {
            "node": "Create spreadsheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "XLSX Data Extractor": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Checkpoint Data": {
      "main": [
        [
          {
            "node": "WOS Field Mapper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Journal Rank Classifier": {
      "main": [
        [
          {
            "node": "Academic Variables Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send process notication": {
      "main": [
        [
          {
            "node": "call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Academic Variables Extractor",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Auto-fixing Output Parser1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Paper Metadata Extractor": {
      "main": [
        [
          {
            "node": "Data Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to Checkpoint Sheet": {
      "main": [
        [
          {
            "node": "Wait for 3s.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Paper Metadata Extractor",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Paper Metadata Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Academic Variables Extractor",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Academic Variables Extractor": {
      "main": [
        [
          {
            "node": "Final Data Mapper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Get Sheet id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 文档提取, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量39
分类2
节点类型17
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者

A graduate student who is learning n8n

外部链接
在 n8n.io 查看

分享此工作流