Bulk Importing and Editing
Scenario: you have a spreadsheet of existing support contracts to load into NetBox, and later need to change many of them at once. You also want to load static routes that reference devices by name.
You'll use: bulk import, bulk edit, export, and updating objects by re-importing them.
Before You Start
- The Support Contract type from A self-contained object type exists.
- For step 5, the Static Route type from Linking to NetBox objects exists, along with the devices you'll reference.
- Your user can add and change Support Contracts and Static Routes.
Steps
1. Check the Import Format
- Click Support Contracts in the navigation menu, then Import.
- Scroll down to Field Options. It lists each field's column name, with a check mark for required ones. Click the ? next to Status to see its accepted values.
2. Import Contracts
-
On the Direct Import tab, paste CSV data whose first row names the fields:
contract_number,vendor,status,start_date,end_date,portal ACME-2001,Acme,active,2026-01-01,2026-12-31,https://support.acme.example ACME-2002,Acme,pending,2026-07-01,2027-06-30,https://support.acme.example GLOBX-17,Globex,expired,2024-01-01,2024-12-31, -
Click Submit. NetBox reports "Imported 3 Support Contracts" and lists them.
-
Try importing two rows where the second has a status that isn't in the choice set, such as
cancelled. The import is rejected with "Record 2 status: Select a valid choice." and neither row is created.
For a large file, enable Background job before submitting. The import then runs in NetBox's background worker, and NetBox links to the job so you can follow its progress.
3. Edit Several Contracts at Once
- In the Support Contracts list, filter by vendor
Acmeand select ACME-2001 and ACME-2002. - Click Edit Selected.
- Set Status to Expired and click Apply. NetBox reports "Updated 2 Support Contracts".
4. Export and Update by Re-importing
-
In the list, click Export and choose All Data (CSV). The file has an ID column with each contract's ID.
-
The exported column headings are the table's column labels, such as
Contract number, while imports expect field names, such ascontract_number. Make an update file with field-name headings, containing just the IDs and the values to change:id,end_date 12,2027-12-31 13,2027-06-30 -
Import it. Rows with an
idupdate those contracts, changing only the columns given; the list that follows shows the contracts that changed. On NetBox 4.6.5 and later, this needs change permission as well as add permission.
5. Import Routes That Reference Devices
-
Open Static Routes, then Import.
-
Paste routes that name their devices:
destination,next_hop,device,metric 10.30.0.0/16,192.0.2.1,core-sw-01,10 10.40.0.0/16,192.0.2.1,core-sw-01,10 -
Click Submit. NetBox reports "Imported 2 Static Routes", each linked to the device named
core-sw-01.
Object fields identify the objects they reference by a natural identifier, here the device's name. See Import and Export for how that identifier is chosen, and for referencing custom objects, which usually have to be identified by ID.
Result
Contracts and routes are loaded in bulk, changed in bulk, and updated from an exported file.
See Also
- Import and Export for the value format of every field type.
- Keeping data clean: imports are validated by the same rules as the edit form.
Workflows
These guides walk through common tasks from start to finish, using example scenarios. Each one lists what you need before you start, the steps to follow in t...
Keeping Data Clean
1. On the Support Contract type's page, open the Fields tab and edit Contract number. 2. Set Validation regex to ^[A-Z]+-[0-9]+$ and save. 3. Try saving a co...