→ كل الوصفات

تحويل فواتير PDF من المورّدين إلى صفوف جدول تلقائيًا

فواتير PDF من المورّدين تتحول إلى صفوف في جدول تلقائيًا.

الأداة: n8nمتوسط✓ مجرّبة بالكامل
↓ تنزيل سير العململف n8n ‏(.json) · بدون أي أسرار، أضف بيانات الدخول الخاصة بك

الخطوات

  1. Schedule Trigger يوميًا الساعة 08:00 (أو تشغيل يدوي).
  2. عقدة Config: رابط PDF، ومفتاح KV لملف CSV، وموضوع ntfy.
  3. HTTP Request ينزّل ملف PDF.
  4. Extract from File يقرأ نص PDF (ملفات نصية، لا صور ممسوحة).
  5. عقدة Code تستخرج رقم الفاتورة والمورّد والتواريخ والمجموع والضريبة والإجمالي والعملة، وتضع needs_review إذا نقص الرقم أو الإجمالي.
  6. يقرأ CSV الحالي من KV، ويتجاهل المكرر برقم الفاتورة، ويضيف صفًا.
  7. يحفظ CSV في KV ويتأكد من النجاح.
  8. تنبيه ntfy: ‏'Invoice logged' أو 'Duplicate invoice skipped'.

ما الذي جرّبناه

✓ مجرّبة بالكامل بتاريخ 2026-10-16، على خدمات حقيقية في n8n 1.70.3. تفاصيل الاختبار (بالإنجليزية):

Ran on local n8n 1.70.3: downloaded a sample text PDF from automaterecipes.pages.dev/samples/sample-invoice.pdf, extracted all 8 fields correctly (INV-2026-0417, total 1081.00 SAR, VAT 141.00), wrote a real CSV to Cloudflare KV (read back and verified) and a real ntfy push arrived. Second run correctly skipped the duplicate. Not tested: scanned/photo invoices (need OCR) and Google Sheets output (needs a Google account).

التكلفة الشهرية

مجانية مع n8n المستضاف ذاتيًا (أنت تشغّل الخادم)، أو من 20 يورو شهريًا مع n8n Cloud Starter بالدفع السنوي. n8n.io/pricing/

Free on self-hosted n8n (you run the server); €20/mo on n8n Cloud Starter, billed annually

الإعداد

تفاصيل الإعداد بالإنجليزية لأنها تطابق أسماء الحقول والعقد داخل الأداة. للبدء من الصفر اقرأ دليل n8n من الصفر.

You will need

  • n8n (self-hosted Community Edition is free; n8n Cloud from €20/mo)
  • Free ntfy app (iOS/Android) or ntfy.sh in a browser – no account needed
  • A free Cloudflare account with a KV namespace (stores the CSV)

Credentials

  • Cloudflare API token with Account → Workers KV Storage → Edit (free Cloudflare account)
  • In n8n: Credentials → New → Header Auth, Name: Authorization, Value: Bearer YOUR_TOKEN

Configure

  • pdfUrl: a link to your invoice PDF (e.g. a public share link). Try the included sample first.
  • cfAccountId, kvNamespaceId, csvKey (default invoices.csv).
  • ntfyTopic: your secret topic.
  • Field patterns live in 'Parse invoice fields' – adjust the labels (e.g. 'Amount due') to match your suppliers.

Test

  • Click Test workflow with the sample PDF: you should get 'Invoice logged: INV-2026-0417'.
  • Run again: you should get 'Duplicate invoice skipped'.
  • Open the KV key to see the CSV; copy it into Excel/Sheets any time.

Common errors

  • needs_review = yes: the PDF uses different labels – edit the regexes in 'Parse invoice fields'.
  • Empty text: the PDF is a scan/photo – this recipe handles text PDFs only.
  • KV step returns 401/403: the token lacks Workers KV Storage Edit, or the Header Auth value is missing the word 'Bearer '.
  • 'key missing or not JSON': create the key in Cloudflare → Workers & Pages → KV → your namespace → Add entry, with a JSON array as the value.
  • Nothing arrives in ntfy: the topic in Config must match the one you subscribed to exactly (case-sensitive).
  • Never runs on its own: toggle the workflow Active – the manual trigger only runs when you click Test workflow.

النسخة الإنجليزية الكاملة ←