A supplier file stores stock as text: In stock: 12 pcs, Only 3 left, Preorder 25 pcs. The import needs a separate qty column that keeps only the number: 12, 3, 25.
Create qty from stock_text and add one transformation: condition Regular expression with \d+, action Remove everything except.
How to do it in Eofferix
Upload the CSV or XLSX file with the
stock_textcolumn and open the table editor. The sample keeps aproductcolumn next to it for row checking.Create the result column
qtyfrom the source columnstock_text.Open the settings for the
qtycolumn with the gear icon in its header.
The animation opens the result column qty, where the extracted number will be stored.In
Transformations, chooseRegular expression, enter\d+, and set the action toRemove everything except.
The regex \d+finds the first number in the text, and the action keeps only that matched fragment.Save the settings and check the preview:
In stock: 12 pcsshould become12, andOnly 3 leftshould become3.
Before / after
Before
source data| stock_text | product |
|---|---|
| In stock: 12 pcs | Hudson desk lamp |
| Only 3 left | Maple wall shelf |
| Preorder 25 pcs | Trail travel mug |
After
result| qty | product |
|---|---|
| 12 | Hudson desk lamp |
| 3 | Maple wall shelf |
| 25 | Trail travel mug |
What to keep in mind
- Use this setup when the first number in the text is the value you need.
- If one cell contains several numbers and you need a later one, make the regular expression more specific.
- After extraction, the number can be used in filters, formulas, and export conditions.