I have a performance report exported in csv format that I want to import into my web app. The data is presented in the following format:
Staff Performance by day | ||||||||
---|---|---|---|---|---|---|---|---|
Bridge Street | ||||||||
Abbi Clarke | ||||||||
Date | Services | Courses | Products | Hours Worked | ||||
EX Vat | Total | Ex Vat | Total | Ex Vat | Total | Hours | Minutes | |
02/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
03/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
04/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
Adam Carter | ||||||||
Date | Services | Courses | Products | Hours Worked | ||||
EX Vat | Total | Ex Vat | Total | Ex Vat | Total | Hours | Minutes | |
02/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
03/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
04/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
James Sharpe | ||||||||
Date | Services | Courses | Products | Hours Worked | ||||
EX Vat | Total | Ex Vat | Total | Ex Vat | Total | Hours | Minutes | |
02/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
03/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
04/01/2019 | 0.00 | 0.00 | 0.30 | 3.50 | 17.90 | 22.90 | 9 | 0 |
I’d like to have each team members data separated out into a slice of maps []map[string][]string
with the team member name as the key and the figures as a slice of string - ignoring all the other stuff.
This would allow me to loop through each map using the encoding/csv package so I can upload it to my database.
How do I approach reading in the document this way?