±insert
Inserts one or more fields (columns) to the CSV data row before or after a specific position.
Inserts one or more new columns next to an existing column of the data row, and optionally fills each of them with a value.
The value can be a literal, the contents of another field, or any expression.
If you want to append one or more columns at the end of the data row instead, then you can use ±add.
Inserting a single Column
Inserts a new column next to an existing column of the data row, and optionally fills it with a value.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.