jueves, 5 de marzo de 2026

Automatiza Facturas con IA usando n8n | OpenAI + Google Drive + Google Sheets

 En este video aprenderás a crear una automatización completa usando n8n!!

Construimos un sistema que lee facturas con IA automáticamente usando n8n.
Extrae datos, guarda en Sheets y mueve archivos en Google Drive sin intervención manual.




Obtener apikey token de chatgpt: platform.openai.com/login

Lo que se usó en el video:

-------------------------------------------------------------------

Extrae de esta factura la siguiente información:

- fecha

- numero_factura

- cliente

- subtotal

- igv

- monto_total

- detalle (array con: nombre_producto, cantidad, subtotal_producto)

Devuelve únicamente JSON válido.

No uses markdown.

No uses ```json.

No agregues texto adicional :

{

  "fecha": "",

  "numero_factura": "",

  "cliente": "",

  "subtotal": "",

  "igv": "",

  "monto_total": "",

  "detalle": [

    {

      "nombre_producto": "",

      "cantidad": "",

      "subtotal_producto": ""

    }

  ]

}

--------------------------------------------

const raw = $json[0].content[0].text;

const data = JSON.parse(raw);


const fileId = $node["Google Drive Trigger"].json["id"];

const fileName = $node["Google Drive Trigger"].json["name"];


return {

  json: {

    fecha: data.fecha,

    numero_factura: data.numero_factura,

    cliente: data.cliente,

    subtotal: data.subtotal,

    igv: data.igv,

    total: data.monto_total,

    detalle: JSON.stringify(data.detalle),

    fileId: fileId,

    fileName: fileName

  }

};

------------------------------------

Procesaron Factura {{$now.format('DD MMM ')}}

Se procesaron las siguientes facturas hoy:

{{ $input.all().map(item => item.json.imagen).join("\n") }}

Datos guardados correctamente en Google Sheets.


ASESORIA PERSONALIZADA :

En caso necesites alguna asesoría personalizada agéndame un espacio.

https://reservarasesoriaanlusoft.blogspot.com/





No hay comentarios:

Publicar un comentario

Automatiza Facturas con IA usando n8n | OpenAI + Google Drive + Google Sheets

 En este video aprenderás a crear una automatización completa usando n8n!! Construimos un sistema que lee facturas con IA automáticamente u...