Hi All
so, not rally sure where to start with this… so please forgive the lack of any script
in short i have around 100 csv’s in one location, all of them have the same headers. The only column i am interested in is column L “ItemCount”.
in a perfect world i would like to total all cells in column L, create a new CSV with the file name of each CSV in one column then the result of the sum in another
Quick link to how excel file looks - Photobucket
As i say ideally i would like a file to look like
Column A Column B
APM01.csv 131
APM03.csv 131
ARD01.csv 1035
ARD03.csv 1035
hoping someone can point me in the right direction, thanks
A little code golf for you.
gci *.csv | % {[pscustomobject]@{total = ((import-csv $).numbers | measure -Sum).sum;csv = $.name}}
Hi Dan
Legend !
gci "\\eurxmbs01\c$\tmpPFStats\*.csv" | % {[pscustomobject]@{total = ((import-csv $_).itemcount | measure -Sum).sum;csv = $_.name}}
thanks
1518 A-SPT01.csv
1518 A-SPT03.csv
102852 APM01.csv
51426 APM03.csv
162 ARD01.csv
162 ARD03.csv
I found this article and it helped me…Question - how can I add the Totals together?
So I have 10 CSV’s - It is actually calculating a SUM of 1 Column in each CSV - It is outputting the correct figure and CSV File but I want a total of all Totals at the end?
I found this article and it helped me…Question - how can I add the Totals together?
So I have 10 CSV’s - It is actually calculating a SUM of 1 Column in each CSV - It is outputting the correct figure and CSV File but I want a total of all Totals at the end?