This article will cover the syntax of the ‘Rename Field’ regular script statement

This statement allows specified fields to be renamed.

Statement syntax

Rename Field  | Fields using mapname | oldname to newname{ , oldname to newname }

Field | FieldsSingle or multiple fields can be specified with the rename statement.
Using MapnameThe fields can be renamed using a previously created map.
Oldname to NewnameIf not using a map, fields and their new names can be specified in a comma separated list.

Example

An ‘id’ field is renamed for clarity after a table containing customer data is loaded.

CUSTOMERS:
LOAD
    id,
    firstName,
    lastName,
    email,
    dob
FROM [lib://Public:DataFiles/customers.xlsx]
(ooxml, embedded labels, table is Sheet1);
Rename field id to customerId;

Result

The ‘CUSTOMERS’ table is loaded and the field ‘id’ is renamed to ‘customerId’.