Skip to content

Instantly share code, notes, and snippets.

@alexalannunes
Last active July 23, 2024 13:32
Show Gist options
  • Save alexalannunes/701174f855da6ec849846909daec7730 to your computer and use it in GitHub Desktop.
Save alexalannunes/701174f855da6ec849846909daec7730 to your computer and use it in GitHub Desktop.
extract bills from nubank
`
15 MAI Picpay *Enel Distribu - Parcela 4/5 R$ 26,46
21 MAI Brisanet*Internet R$ 94,99
22 MAI Pagamento em 22 MAI -R$ 1.160,77
22 MAI Saldo restante da fatura anterior R$ 0,00
22 MAI Saldo restante da fatura anterior R$ 0,00
24 MAI Mercadinho e Hortifrut R$ 4,50
24 MAI Angela Maria Morais S R$ 14,36
24 MAI Mercantil Mundinho R$ 9,61
24 MAI Google Adobe Inc R$ 7,99
24 MAI Leila Carneiro Matias R$ 5,00
25 MAI Mercantil Mundinho R$ 22,38
25 MAI Mercantil Mundinho R$ 8,47
25 MAI Pag*Mariamarleide R$ 22,00
`.split('\n').filter(s => !!s).map(line => {
const regex = /(\d{1,2}\s[A-Z]{3})\s(.+)\sR\$\s?([\d.,]+)/;
const [,date, desc, price] = line.match(regex)
return `${date}, ${desc}, ${price}`;
}).join('\n');
@alexalannunes
Copy link
Author

idea: Made a ui for this

  • Enter a raw text
  • Configure matches
  • Display a table and copy coluns or copy for a google sheet

Bonus

  • Table generated can sum amount grouped by person (made editable) like
person amount
alex R$ 89,00
alice R$ 189,00

=====

total R$ 278,00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment