±insert
Inserts a field (a column) to the CSV data row before a specific position.
Description
Inserts a new column before an existing column 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 append a column at the end of the data row instead, then you can use ±add.
Pattern
±insert[NewFieldName]@[ExistingFieldname]
±insert[NewFieldName]@[ExistingFieldname]=NewFieldValue
Usage Examples
If there is a csv file:
Product | Product Weight | Transport Weight |
---|---|---|
Apple | 100g | 105,000g |
Pear | 120g | 126,000g |
Banana | 200g | 210,000g |
- -insert["Product ID"]@["Product Weight"]
- Inserts a new empty column "Product ID" before the column "Product Weight". A subsequent field command can later be used to fill it with a value.
Product | Product ID | Product Weight | Transport Weight |
---|---|---|---|
Apple | 100g | 105,000g | |
Pear | 120g | 126,000g | |
Banana | 200g | 210,000g |
More examples
- -insert["Line Number"]@[1]=(#)
- Inserts a new first column "Line Number" before the recent first column, and initializes it with the current data row number.