Where they go
Custom commands belong to a saved interface. So set the import up in the window first, and save it with Import & Save Interface. Then:
- Open Tools › Settings and expand Sales Data Interfaces.
- On the interface's row, click the ... button under Custom Commands. The number beside it is how many it has.
- Click the green plus to add a line, and fill in its Command, Parameter 1 and Parameter 2. Leave a parameter empty when a command doesn't need it.
- Save the settings. The commands apply the next time the interface runs, with Open or Load Data.
The arrows change the order, the red cross deletes a line, and the plus on a line inserts one below it. Order matters for some commands, as this page says where it does.
Finding columns by heading
A saved interface remembers columns by their letters and rows by their numbers. If the file's columns move from one month to the next, have Spanner find them by their headings instead. It looks in the first 50 rows of the first sheet it imports, when the file is read.
| Command | Parameters | What it does |
|---|---|---|
| ID Code | 1: the heading | The Product ID column is the one whose heading is exactly this, such as Product Code. |
| Description | 1: the heading | The Product Name column, in the same way. |
| Measure Row, Measure Column | 1: some text 2: optional, more text | The measures are in the row, or the column, of the first cell that contains either text. |
| Time Row, Time Column | 1, 2: as above | The time headings, in the same way. |
| Time2 Row, Time2 Column | 1, 2: as above | The second time row, when the length and the year are on two rows. |
| Outlet Row, Outlet Column | 1, 2: outlet names, separated by spaces | The outlets, in the same way. Write a space inside a name as <sp>: Retailer<sp>A. |
| Move Header Text | 1: Measure to Time 2: the text | Moves text from the measure headings to the time headings. For headings such as Units and Units Year Ago over periods such as 52 weeks: Parameter 2 Year Ago, with its space, leaves Units as the measure twice, and the time headings become 52 weeks and 52 weeks Year Ago. Headings in rows only; only the first such command is used. |
Product codes
These change the file's product codes before they are matched to your products. They change nothing in your document. Only one of them is used: if there are several, the first in this table wins.
| Command | What it does to the file's codes |
|---|---|
| Check Digit | Adds the missing last digit to codes of 7 or 12 digits, so they match full 8 and 13 digit barcodes. |
| IRI2UPC | Turns Circana (IRI) product codes into barcodes. |
| IRI2UPC813 | As IRI2UPC, then short barcodes back to 8 digits. |
| IRI2UPC13 | As IRI2UPC, then zeros added to the front to make 13 digits. |
| UPC13 | Adds zeros to the front of codes shorter than 13 characters. |
| UPC813 | Codes shorter than 8 become 8 digits, and those of 8 to 12 become 13. |
| ID = Desc | For a file with no codes: each row's product name, from the Product Name columns, becomes its code. Product ID must still be set to a column: give it the name column. |
Since 2.5.1.0 Spanner already adds zeros to the front of barcodes to compare them, so UPC13 and UPC813 are seldom needed now. Check Digit and the Circana commands still are.
Match To
| Command | Parameters | What it does |
|---|---|---|
| Match To | 1: a classification's heading | After the usual matching, matches the products still unmatched whose value in that classification is exactly the file's code. For a retailer's code that you keep in a classification rather than in Matches. |
A match made this way is stored in the product's Matches too, when Update Product Matches is ticked, so the next import finds it in the usual way.
Matching outlets
| Command | Parameters | What it does |
|---|---|---|
| Outlet Match | 1: All | Every outlet in the file that isn't matched goes into the document's outlet of the same name, which is added if the document hasn't got it. |
| Outlet Match | 1: All Except 2: outlet names, separated by spaces | The same, leaving out the outlets named. Write a space inside a name as <sp>. |
Use it for a file whose list of retailers or markets changes from time to time, so new ones come in without opening the window.
Matching periods by their words
A saved interface remembers each time heading's match by its exact text. When the headings carry dates, next month's file doesn't match. Time Match commands match periods by words that stay the same instead. They work on the time headings still unmatched.
| Command | Parameters | What it does |
|---|---|---|
| Time Match | 1: 1 2: some text | Headings that contain the text are Time 1. |
| Time Match | 1: 2 2: some text | Headings that contain the text are Time 2. |
| Time Match | 1: TY 2: some text | Headings that contain the text are the latest year. |
| Time Match | 1: YA 2: some text | Headings that contain the text are the previous year. |
| Time Match | 1: Delete 2: some text | Takes the text out of the headings before Spanner looks for dates in them. |
| Time Match Replace | 1: text to find 2: text to put in its place | The same, putting other text in its place. |
A heading is matched when it has both a length and a year. Each period goes to one heading only. For example, with the made-up headings Latest 52 Weeks, Year Ago 52 Weeks, Latest 12 Weeks and Year Ago 12 Weeks:
| Command | Parameter 1 | Parameter 2 |
|---|---|---|
| Time Match | 1 | 52 Weeks |
| Time Match | 2 | 12 Weeks |
| Time Match | TY | Latest |
| Time Match | YA | Year Ago |
When the headings give only the length, and a date, such as 52 w/e 05/10/25 and 52 w/e 06/10/24: match the lengths with 1 and 2, and use Delete to take out 52 w/e and 12 w/e , leaving the dates. Spanner then takes the earlier of the two dates as the previous year and the later as the latest. Dates are read as your computer writes them, so a UK computer reads 05/10/25 as 5 October 2025.
Scaling
These multiply the figures as they come in: by 1000 for a file in thousands, or by 0.01 for percentages written as 45 that your document holds as 0.45.
| Command | Parameters | What it does |
|---|---|---|
| Measure Scale | 1: a measure code, such as VALUE 2: the number to multiply by | Scales that measure in every outlet and period. |
| Time Scale | 1: the periods 2: the number | Scales every measure in the periods named: 1 or Time 1; 2 or Time 2; TY or Latest; YA, LY or Previous; or one period, 1L (or Time 1 Latest), 1P, 2L, 2P. |
| Measure Time Scale | 1: a measure code, a space and a period: VALUE 1TY; the periods are 1TY, 1LY, 2TY, 2LY 2: the number | Scales one measure in one period. |
The three kinds multiply together. Two of the same kind for the same thing don't: the later one replaces the earlier. Before 2.5.1.2, Time Scale ignored 1, scaled Time 1 for 2, and scaled the latest year for YA, LY and Previous; with those versions, use Time 1, Time 2 or the single periods.
Calculations
The Import Calculations of the window's second tab (see Importing Sales Data) are saved as custom commands too, one for each line, in the order they run:
| Command | Parameters | What it does |
|---|---|---|
| Import Calculate | 1: the measure to fill, by its code 2: the formula | Works the measure out for each imported product, in each outlet and period the file has. |
Formulas use measure codes, numbers, + - * / and full brackets: each operator joins two things, so write (A-B)-C, never A-B-C, and (0-A) for a minus sign.
Totals of the file
A formula can also use a total over every product in the file, for the same outlet and period: put sum, ave, max, min or count straight in front of a measure code. For example, a measure for each product's share of the file's value sales:
| Command | Parameter 1 | Parameter 2 |
|---|---|---|
| Import Calculate | SHARE | (VALUE/sumVALUE)*100 |
The totals take in every row of the file, matched to a product or not, and are added up before any scaling. The document needs the measure to fill, here one with the code SHARE.
Temporary measures and copying
Some files put a figure where Spanner can't take it directly: last year's sales as a second measure, for instance, beside this year's, under one period. A temporary measure takes it in, and Copy After moves it to where it belongs.
| Command | Parameters | What it does |
|---|---|---|
| Temp Measure | 1: a code, a space and a description: TEMP2 Sales Last Year 2: optional, a calculation | Adds a measure to the document while the interface runs, and takes it away after the import. Match the file's heading to it as to any measure. |
| Copy After | 1: the figures to copy 2: where to copy them | After the import, copies figures from one measure, outlet and period to another, for every product in the document. |
Copy After's parameters are sales codes of four parts joined by _: measure, outlet, length and year.
- Outlet:
*for every outlet,OUfor the selected planogram's outlet,CHfor its channel, or an outlet's name. - Length:
1,2or*for both. - Year:
TY,YAor*for both.
Both codes must cover the same number of outlets, lengths and years. For the example above: match Sales This Year to Value and Sales Last Year to TEMP2, with Time fixed at Time 1 latest, then:
| Command | Parameter 1 | Parameter 2 |
|---|---|---|
| Temp Measure | TEMP2 Sales Last Year | |
| Copy After | TEMP2_*_1_TY | VALUE_*_1_YA |
Several Copy After commands run in their order. Before 2.5.1.2 only the last one ran, and an outlet named on the copying-to side was taken as the copying-from side's outlet: with those versions, use one Copy After with *, OU or CH there. For headings in rows, Move Header Text is often simpler.
Adding products
With Add Unmatched Products ticked, every row of the file that finds no product becomes a new product. Add Criteria limits that to the rows that sell. The Criteria box in the window (see Importing Sales Data) edits these same commands.
| Command | Parameters | What it does |
|---|---|---|
| Add Criteria | 1: a sales code, such as VALUE_*_*_* 2: one or more conditions, such as >0 | Adds a product only if one of its figures for that code meets the conditions. |
- The sales code has the four parts of Copy After's, with two more choices for the outlet:
OUCHfor the selected planogram's outlet and channel, and a number for the outlet's place in the document's list, counting from 0.OU,CHandOUCHneed a planogram selected. - The conditions are
>,>=,<,<=or=and a number, such as>=1000. Separate several with spaces:>=1000 <=50000. Each is checked on its own, so with a*in the code, one outlet or period can meet one condition and another the next. - Several Add Criteria commands must all be met.
For example, VALUE_*_1_TY and >=1000 adds the products that sold at least 1000 in some outlet in the latest Time 1. Criteria only decide which new products are added; matched products always get their figures. Rows you tick to add in the window's Match to Excel list skip the criteria: see Importing Sales Data. Before 2.5.1.2, products were only added with the Update Data option.
Weekly figures into longer periods
A retailer's portal often gives a column for each week. Spanner can add the weeks up into its four periods as the file comes in: the latest 52 weeks, the 52 before them, and so on. The time headings must be along one row or down one column of their own, not shared with measures or outlets.
It works in three stages. Each time heading has a working copy that the first commands tidy into a date; the grouping commands then pick the weeks for each period by their dates; and Aggregate says how to add each measure up.
1. Tidy the headings into dates
These run in their order, on the working copy only.
| Command | Parameters | Keeps |
|---|---|---|
| Time After | 1: some text 2: optional, incl | What follows the text; with incl, the text too. |
| Time Before | 1: some text 2: optional, incl | What comes before the text; with incl, the text too. |
| Time Left, Time Right | 1: a number of characters | That many characters from the left, or the right. |
| Time Mid | 1: where to start, counting from 0 2: how many | Characters from the middle. |
| Time Substitute | 1: text to find 2: text to put in its place | The heading, with the text replaced. |
| Time Date Value | Reads what is left as a date, such as 05/10/2025, in your computer's date order. | |
| Time Value | Reads what is left as Excel's number for a date, such as 45935. |
2. Group the weeks
Each names a period as 1L, 1P, 2L or 2P, and each period can have one group.
| Command | Parameters | Takes |
|---|---|---|
| Time Group Last | 1: how many weeks 2: the period | The latest weeks, by date. |
| Time Group First | 1: how many weeks 2: the period | The earliest weeks. |
| Time Group Mid | 1: weeks to skip, a space, and how many to take: 40 12 2: the period | Weeks from the middle: skip the earliest, then take. |
| Time Group Column | 1: two column letters: C BB 2: the period | The weeks in those columns, for headings along a row. Put it before any command that tidies the headings. |
3. Say how to add up each measure
| Command | Parameters | What it does |
|---|---|---|
| Aggregate | 1: a measure code 2: Sum, Sum>0, Average, Average>0, Count or Count>0 | How the weeks of each group become one figure. >0 leaves out weeks with nothing. A measure with no Aggregate command has no figures in the grouped periods. |
Use Sum for sales, and Average or Average>0 for distribution or price. In the second tab, the groups appear as headings such as Σ52 Weeks Latest, already matched to their periods; match the measures as usual.
For example, a made-up file with 104 weekly columns headed w/e 05/10/2025 and so on along row 2, under Value and Units in row 1:
| Command | Parameter 1 | Parameter 2 |
|---|---|---|
| Time After | w/e | |
| Time Date Value | ||
| Time Group Last | 52 | 1L |
| Time Group First | 52 | 1P |
| Time Group Last | 12 | 2L |
| Time Group Mid | 40 12 | 2P |
| Aggregate | VALUE | Sum |
| Aggregate | UNITS | Sum |
Time 1 is the latest 52 weeks and the 52 before them; Time 2 is the latest 12 weeks, and the 12 weeks a year before them, which are weeks 41 to 52 counting from the earliest. The document's Time 1 and Time 2 should say 52 and 12.
Adding outlets together
A file of stores, or of a retailer's formats, can be added up into fewer outlets as it comes in. The outlet headings must be along one row or down one column of their own. It works as weekly grouping does: each outlet heading has a working copy, the commands change it, and outlets whose working copies end up the same are added together under that name.
| Command | Parameters | What it does |
|---|---|---|
| Outlet Group | 1: a name | Turns grouping on. Outlets that no other command changes are added together under this name; without a name, Grouped Outlets. |
| Outlet Contains | 1: some text 2: a name | Outlets whose name contains the text are added together under the name. |
| Outlet Substitute | 1: text to find 2: text to put in its place | Changes the working copy, so outlets that then read the same go together. |
| Aggregate | 1: a measure code 2: how | As for weekly figures: one for each measure. |
For example, with made-up stores Express 0123, Express 0456 and Superstore 0789:
| Command | Parameter 1 | Parameter 2 |
|---|---|---|
| Outlet Group | Supermarkets | |
| Outlet Contains | Express | Convenience |
| Aggregate | VALUE | Sum |
The two Express stores are added up as Convenience, and the superstore, which nothing changed, as Supermarkets. In the second tab, match those two to outlets in the document, as in Importing Sales Data.
Other commands
| Command | Parameters | What it does |
|---|---|---|
| No Data | Runs the import without writing any figures: only the match codes and the classification columns. Useful to store a file's codes on your products, or to code products from a sales file. | |
| No Ignored | Doesn't read the sheets the interface leaves out at all, rather than reading and then ignoring them. Quicker for a large workbook with many sheets. | |
| Update Library Matches | After the import, writes the match codes it stored on your products to the product library each product came from, so other documents have them. The library needs a Matches column. Needs Update Product Matches ticked, from 2.5.1.2. | |
| pre: or post: and an automation command, such as post:Calculate | 1, 2: that command's parameters | Runs the automation command before or after the import. See the automation reference. |
Spanner has a few more commands, for working figures out across grouped outlets and periods, which very few files need. If a file still won't import, ask us.
Ask Spanner AI
Spanner AI knows these commands, and adds them to an import when the file needs them: finding columns by heading, product codes and Match To, matching outlets and periods, scaling, calculations and totals of the file, temporary measures, copying, adding products, and weekly or outlet grouping. Grouping through Spanner AI needs Spanner 2.5.1.2 or later.
- "The barcodes in this file have lost their last digit. Can you still match them?"
- "The file is in thousands: scale value sales up as it comes in."
- "Match the periods by their words, so the import still works next month."
- "Work out price from value and units as the file comes in."
- "This file has a column for each week. Add them up into the latest 52 and 12 weeks and the year before."