Skip to content

Instantly share code, notes, and snippets.

@emeraldsanto
Last active July 17, 2023 22:16
Show Gist options
  • Save emeraldsanto/a7248c2faf1df12d681e635854cedd08 to your computer and use it in GitHub Desktop.
Save emeraldsanto/a7248c2faf1df12d681e635854cedd08 to your computer and use it in GitHub Desktop.
Script to sum the amount of all Compt claims
[...document.querySelectorAll('#past-expenses-table .td.small:nth-child(5)')].reduce(
(total, cell) => {
const amountWithCurrencyAsString = cell.innerHTML;
const amountWithoutCurrencyAsString = amountWithCurrencyAsString.slice(3); // $CA...
return total + parseFloat(amountWithoutCurrencyAsString);
},
0
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment