Created
October 16, 2019 11:03
-
-
Save chris-gunawardena/8158ede94ff71a89ec138de014f573bd to your computer and use it in GitHub Desktop.
ovchipcart csv to travel expense sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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