Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Make sure your csv has these headers:
- description,dateAcquired,dateSold,salesPrice,cost
- Convert csv to json.
- Paste the following code into the console.
- Run fillAll with the json as an argument.
- */
- function fill(n, obj){
- const baseSel = `capitalGains[${n}]`
- for (const key in obj) {
- const sel = `${baseSel}.${key}`;
- const el = document.getElementsByName(sel)[0];
- el.value = obj[key];
- }
- }
- function fillAll(objs) {
- for (const [i, obj] of objs.entries()) {
- fill(i, obj);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement