±add
Appends another field (column) to the CSV data row, optionally with a field value
Appends a new column to the end of the data row, and optionally fills it with a value.
The value can be a literal, the contents of another field, or any expression.
If you want to insert a new column at the beginning or somewhere between other other columns instead, then you can use ±insert.
Pattern
±add[NewFieldName]
±add[NewFieldName]=NewFieldValue
Usage
- -add[NewFieldName]
- Appends a new column
NewFieldName to the line. - -add[NewFieldName]=NewFieldValue
- Appends a new column
NewFieldName to the line and fills it withNewFieldValue
.
NewFieldValue can be a literal, a field or any expression.
Example
If there is a csv file:
Product | Product Weight |
---|---|
Apple | 100g |
Pear | 120g |
- -add["Transport Weight"]={(1,05*["Product Weight"]),3}g
- Appends a new column
Transport Weight to the line and fills it with the value of the fieldProduct Weight * 1.05. The output shall be with decimal comma and 3 decimal places.
The quotes are necessary because of the whitespace in the column name.
Product | Product Weight | Transport Weight |
---|---|---|
Apple | 100g | 105,000g |
Pear | 120g | 126,000g |