Sum a CSV property with PowerShell
Build a paste-ready command, then review its compatibility and effects before running it.
(Import-Csv <file> | Measure-Object -Property <property> -Sum).SumComplete required fields to copy the generated command.
read-onlyno known side effects Compatibility
WindowsVerified for Windows using powershell syntax.
Operational knowledgereview due 2027-01-19
Requirementsshellshell must be installed and available on PATH.
Version supportshell Current supported releasesVerified for windows using powershell syntax; consult compatibility notes for platform-specific differences.
Expected signals18432.75Representative successful output; values vary with the selected target and system state.
Known errorsshell: command not foundshell is missing or is not available on PATH.
Verify(Import-Csv {{file}} | Measure-Object -Property {{property}} -Sum).SumThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01(Import-CsvCommandRuns the (Import-Csv stage of this one-liner.
02<file>ParameterA value supplied in the Fill parameters section.
03|PipelinePasses the output on the left to the command on the right.
04Measure-ObjectCommandRuns the Measure-Object stage of this one-liner.
05-PropertyOptionConfigures Measure-Object with the -Property option.
06<property>ParameterA value supplied in the Fill parameters section.
07-Sum).SumOptionConfigures Measure-Object with the -Sum).Sum option.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
(Import-Csv .\invoices.csv | Measure-Object -Property Amount -Sum).Sum
Illustrative output — exact values vary by system and data.
Official sources