Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-gunawardena/8158ede94ff71a89ec138de014f573bd to your computer and use it in GitHub Desktop.
Save chris-gunawardena/8158ede94ff71a89ec138de014f573bd to your computer and use it in GitHub Desktop.
ovchipcart csv to travel expense sheet
var x = {}
csv.split("\n").slice(1).map(r => {
const [date, amount] = [r.split(";")[0], r.split(";")[5]].map(c => c.replace(/"/g, ''));
const [day] = date.split('-');
x[day] = (x[day] || 0) + Number(amount);
});
Object.keys(x).map(day => document.querySelector(`#d${day}-0`).value = x[day]);
console.log(x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment