Auto-Generate Anki Flashcards for Language Learning with n8n: Google Translate + GPT for Phonetics & Examples
Enter an English word in Google Sheet → auto-translate to target language → AI generates phonetics/pinyin and example sentence → fetch image and write back → import to Anki
- Who
- Language learners, educators, or anyone looking to reduce manual flashcard creation time
- You get
- After adding a word to Google Sheet, automatically get translation, phonetics/pinyin, example sentence, and illustration ready for Anki import
- You need
- n8n · Google Sheets · Google Translate · Pexels · Google Drive
Constraints
Requires an n8n instance (1.82.1+ recommended). Prerequisites: Google Drive account with folder; OAuth2-enabled Google Drive API, Google Sheets API, and Google Translate API credentials; free Pexels API key; a Google Sheet with required columns. All services can use free-tier plans.
What they did
Template author Samir Saci, a Supply Chain Data Scientist based in Paris who spent six years in China, designed this n8n workflow to automate Mandarin flashcard creation. The workflow triggers on Google Sheet row additions, automatically performing translation, pinyin extraction, example sentence generation, and image retrieval, then writes all fields back to the same sheet for Anki import. Published on n8n.io as template #3195, created with n8n 1.82.1.
How it went
The author reports that the workflow can automatically convert an English word (e.g., 'Contract') into Simplified Chinese (合同), pinyin (Hétóng), example sentence (我们签订了一份合同), and download an illustration, with all fields written to Google Sheet for direct Anki import. The template claims to work with free-tier plans and requires no advanced programming skills. (author_report)
Worth knowing
1. Language adaptability: Though demonstrated with Mandarin/pinyin, the author states any language can be used by replacing 'pinyin' with the target phonetic term in the AI Agent prompt. 2. Flexible triggers: Beyond Google Sheet row additions, the workflow can be adapted for batch processing, Telegram, email, or webhook triggers. 3. Known mapping quirk: In workflow.json, the 'Add Results in Sheet' node has crossed assignments (image_link takes image_name value and vice versa); verify and correct during setup. 4. Credential requirements: Google services require OAuth2 credentials, not just API keys; Pexels requires free registration for API key. 5. Unverified aspects: Pexels API empty result handling, Google Drive folder permissions, and stability at large batch volumes are not addressed in the source.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- Replace __UKH_BEARER_10__ with your real secret/token (path /nodes/10/parameters/headerParameters/parameters/0/value; literal auth header).
Configuration to replace
- Source template is n8n public workflow #3195 (~22 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use. 1 literal secret value(s) replaced with __UKH_…__ placeholders.
Template retrieved: 2026-10-24
Steps
Configure Google Sheet Trigger and Translation
Set up the workflow trigger in n8n: start when a new row is added to the specified column (initialText) in Google Sheets. Then translate the English word to the target language via Google Translate. Specific actions: 1. Add 'Google Sheets Trigger' node, select 'Row Added' event, configure Google Sheets API credentials, and select the target spreadsheet and sheet 2. Add 'Google Translate' node, set input text to `{{ $json.initialText }}`, target language to zh-CN (or your desired language code) 3. Add 'IF' node to check if initialText is empty; if empty, route to 'No Operation' and terminate
Setup guidance · Editorial suggestion。n8n workflow editor; for setup assistant to confirm inputs and permissions
Please configure the first step of the n8n workflow based on the following: - Trigger: Google Sheets Trigger, event type Row Added, monitoring column initialText - Translation node: Google Translate, input `{{ $json.initialText }}`, target language zh-CN - Conditional branch: IF node checking `{{ $json.initialText }}` is not empty First confirm your Google Sheets API credentials are configured and you have the spreadsheet ID ready.Configure AI Agent for Phonetics and Example Sentence
Pass the translated result to an AI Agent that uses an OpenAI model to generate phonetics (pinyin or equivalent) and a short example sentence. Output must follow a fixed JSON format. Specific actions: 1. Add 'AI Agent' node (LangChain Agent), set input text to `{{ $json.translatedText }}` 2. Connect 'OpenAI Chat Model' sub-node, select gpt-4o-mini (or gpt-4o) 3. Connect 'Structured Output Parser' sub-node, define JSON Schema with pinyin and sentence fields 4. Enter the system message below into the AI Agent's System Message field 5. Add 'Set' node to extract output.pinyin and output.sentence into phonetic and example fields
Execution prompt · Source text。AI Agent node System Message field
# Role You are a helpful translation agent that will help users to extract the pinyin from Chinese characters to create flashcard for language learning. # Context You will receive a word or sentence in simplified Chinese characters; you are expected to extract the pinyin and generate a simple sentence in Chinese to illustrate the sense of the word. # Tasks 1. Generate the pinyin of the characters presented 2. Propose a short sentence in mandarin to illustrate the definition of the word. # Notes - Generate the output in JSON format following the example below: {"pinyin": "Cāngkù", "sentence": "卡车抵达仓库。"} - Be very diligent in thinking about the task being asked from you. - Generate concise sentences as they need to fit in flash cards.Configure Pexels Image Retrieval and Google Drive Upload
Search for an illustration using the original English word on Pexels free image database, download it, and upload to Google Drive to obtain a shareable link. Specific actions: 1. Add 'Set' node to extract initialText as the search keyword 2. Add 'HTTP Request' node calling Pexels API: `GET https://api.pexels.com/v1/search?query={{ $json.initialText }}`, with Header `Authorization: <PEXELS_API_KEY>` 3. Add second 'HTTP Request' node to download the image, URL set to `{{ $json.photos[0].src.medium }}` 4. Add 'Google Drive' upload node, filename `{{ $('Trigger Added Row').item.json.initialText }}.jpeg`, select target folder 5. Add 'Set' node to extract webContentLink as image_link
Setup guidance · Editorial suggestion。n8n workflow editor; HTTP Request and Google Drive node configuration
Please configure the Pexels image retrieval nodes: - HTTP Request node: URL `https://api.pexels.com/v1/search`, Query param name=query, value=`{{ $('Trigger Added Row').item.json.initialText }}` - Header param name=Authorization, value=your Pexels API key - Download node: URL `{{ $json.photos[0].src.medium }}` Then configure Google Drive upload node: - Filename: `{{ $('Trigger Added Row').item.json.initialText }}.jpeg` - Select parent Drive and target folder Finally extract `{{ $json.webContentLink }}` as the image link.Merge Results and Update Google Sheet
Combine translation results, phonetics/example sentence, and image link, then update the corresponding row in the original Google Sheet. Specific actions: 1. Add 'Merge' node (combineBySql mode) to merge translation branch and AI Agent branch 2. Add second 'Merge' node (combineByPosition mode) to merge image branch 3. Add 'Google Sheets' node, operation type 'Update', matching column set to initialText 4. Map fields: initialText, translatedText, phonetic, sentence, image_name, image_link 5. Note: The template has crossed mapping for image_link and image_name; adjust according to actual needs
Setup guidance · Editorial suggestion。n8n workflow editor; Merge and Google Sheets node configuration
Please configure the final merge and write-back nodes: - Merge node 1: combineBySql mode, merge translation data with phonetic/example data - Merge node 2: combineByPosition mode, merge image data - Google Sheets node: operation=update, matchingColumns=["initialText"] - Field mappings: - initialText = {{ $json.initialText }} - translatedText = {{ $json.translatedText }} - phonetic = {{ $json.phonetic }} - sentence = {{ $json.example }} - image_name = {{ $json.image_name }} - image_link = {{ $json.image_link }} Confirm your sheet includes these column names and test with a single row first.
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant to confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
You are setting up an n8n workflow to automatically generate language learning flashcards. Core flow: Google Sheet trigger → Google Translate → AI Agent generates phonetics/example → Pexels image → merge and write back to sheet. First confirm you have: Google OAuth2 credentials (Drive/Sheets/Translate), Pexels API key, target Google Sheet (with initialText column), and n8n 1.82.1+. Then configure nodes step by step, paying special attention to the AI Agent System Message which must maintain JSON output format.
To adapt for non-Chinese languages, replace 'pinyin' in the prompt with your target phonetic label (e.g., 'phonetic') and adjust the target language code.
Source
🉑 Generate Anki flash cards for language learning with Google Translate and GPT · samirsaci · n8n.io · 2025-03-17
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.