CSV import: add support for alternate separators #8357

Closed
opened 2025-12-29 20:35:44 +01:00 by adam · 9 comments
Owner

Originally created by @saerdnaer on GitHub (Jul 21, 2023).

Originally assigned to: @abhi1693 on GitHub.

NetBox version

v3.5.3

Feature type

Change to existing functionality

Proposed functionality

  • Currently the CSV import only supports , as field seperator – it would really help if it would support ; and \t aka , too.

Use case

  • copy&paste tables from spreadsheet software to the import text-area of the web UI,
  • import CSV files create with Numbers, etc.

Database changes

No response

External dependencies

No response

Originally created by @saerdnaer on GitHub (Jul 21, 2023). Originally assigned to: @abhi1693 on GitHub. ### NetBox version v3.5.3 ### Feature type Change to existing functionality ### Proposed functionality - Currently the CSV import only supports `,` as field seperator – it would really help if it would support `;` and `\t` aka ` `, too. ### Use case * copy&paste tables from spreadsheet software to the import text-area of the web UI, * import CSV files create with Numbers, etc. ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 20:35:44 +01:00
adam closed this issue 2025-12-29 20:35:45 +01:00
Author
Owner

@andershagman commented on GitHub (Jul 23, 2023):

This would help a lot. ; is used by Excel in many European countries. If you save in csv format in France or Sweden, Excel will use ;.

@andershagman commented on GitHub (Jul 23, 2023): This would help a lot. `;` is used by Excel in many European countries. If you save in csv format in France or Sweden, Excel will use `;`.
Author
Owner

@abhi1693 commented on GitHub (Jul 23, 2023):

From your description, I just want to point out that \t is used for tsv files. Although they are not so different but I'm not sure if that'll be in scope for the change here

@abhi1693 commented on GitHub (Jul 23, 2023): From your description, I just want to point out that `\t` is used for tsv files. Although they are not so different but I'm not sure if that'll be in scope for the change here
Author
Owner

@pv2b commented on GitHub (Sep 4, 2023):

From your description, I just want to point out that \t is used for tsv files. Although they are not so different but I'm not sure if that'll be in scope for the change here

I believe that'll be in the scope of the change here, because one of the quoted use cases:

copy&paste tables from spreadsheet software to the import text-area of the web UI,

To expand a little on this, when you want to prepare some bulk data for import, it's often convenient to use something like Microsoft Excel to prepare the data. Often these documents are pure "scratch pads" to arrange the data in the right way prior to import. When you copy data out of Excel, and paste it into a text form such as the Netbox bulk import field, the data ends up being tab-separated.

To be able to support this usecase as accepted therefore tab-separated values will need to be included.

It makes perfect sense to implement this as part of the CSV functionality, most libraries such as the csv library in Python as well as the Import-Csv and Export-Csv both support using the tab character as my delimiter.

In fact my current workflow is basically creating tables in Excel, and then using this PowerShell oneliner to convert TSV into CSV:

Get-Clipboard | ConvertFrom-Csv -Delimiter "`t" | ConvertTo-Csv -Delimiter "," -NoTypeInformation | Set-Clipboard

Again demonstrating that treating TSV as a dialect of CSV is common. :-)

@pv2b commented on GitHub (Sep 4, 2023): > From your description, I just want to point out that `\t` is used for tsv files. Although they are not so different but I'm not sure if that'll be in scope for the change here I believe that'll be in the scope of the change here, because one of the quoted use cases: > copy&paste tables from spreadsheet software to the import text-area of the web UI, To expand a little on this, when you want to prepare some bulk data for import, it's often convenient to use something like Microsoft Excel to prepare the data. Often these documents are pure "scratch pads" to arrange the data in the right way prior to import. When you copy data out of Excel, and paste it into a text form such as the Netbox bulk import field, the data ends up being tab-separated. To be able to support this usecase as accepted therefore tab-separated values will need to be included. It makes perfect sense to implement this as part of the CSV functionality, most libraries such as the [csv library in Python](https://docs.python.org/3/library/csv.html) as well as the [Import-Csv](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-csv?view=powershell-7.3]) and [Export-Csv](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-7.3) both support using the tab character as my delimiter. In fact my current workflow is basically creating tables in Excel, and then using this PowerShell oneliner to convert TSV into CSV: ```powershell Get-Clipboard | ConvertFrom-Csv -Delimiter "`t" | ConvertTo-Csv -Delimiter "," -NoTypeInformation | Set-Clipboard ``` Again demonstrating that treating TSV as a dialect of CSV is common. :-)
Author
Owner

@abhi1693 commented on GitHub (Sep 4, 2023):

@pv2b I did already include a tab in the implementation. Could test your use cases with https://github.com/netbox-community/netbox/pull/13563 to make sure this works for you?

@abhi1693 commented on GitHub (Sep 4, 2023): @pv2b I did already include a tab in the implementation. Could test your use cases with https://github.com/netbox-community/netbox/pull/13563 to make sure this works for you?
Author
Owner

@pv2b commented on GitHub (Sep 4, 2023):

@pv2b I did already include a tab in the implementation. Could test your use cases with #13563 to make sure this works for you?

It works when picking the delimiter manually. However autodetect doesn't seem to work for tab-separated files! It's not a big deal, but it would be nice if tab-seperated files were autodetected.

@pv2b commented on GitHub (Sep 4, 2023): > @pv2b I did already include a tab in the implementation. Could test your use cases with #13563 to make sure this works for you? It works when picking the delimiter manually. However autodetect doesn't seem to work for tab-separated files! It's not a big deal, but it would be nice if tab-seperated files were autodetected.
Author
Owner

@abhi1693 commented on GitHub (Sep 4, 2023):

It's not possible to add a tab delimiter to the auto-detect due to the limitations of the sniff function. It can only work with a single character delimiter whereas the tab uses 2 characters.

@abhi1693 commented on GitHub (Sep 4, 2023): It's not possible to add a tab delimiter to the auto-detect due to the limitations of the sniff function. It can only work with a single character delimiter whereas the tab uses 2 characters.
Author
Owner

@pv2b commented on GitHub (Sep 4, 2023):

It's not possible to add a tab delimiter to the auto-detect due to the limitations of the sniff function. It can only work with a single character delimiter whereas the tab uses 2 characters.

Tab is a single character, not two characters

@pv2b commented on GitHub (Sep 4, 2023): > It's not possible to add a tab delimiter to the auto-detect due to the limitations of the sniff function. It can only work with a single character delimiter whereas the tab uses 2 characters. Tab is a single character, not two characters
Author
Owner

@abhi1693 commented on GitHub (Sep 4, 2023):

tab requires \t which is considered two characters by the sniff function internals

@abhi1693 commented on GitHub (Sep 4, 2023): tab requires `\t` which is considered two characters by the sniff function internals
Author
Owner

@kkthxbye-code commented on GitHub (Sep 4, 2023):

tab requires \t which is considered two characters by the sniff function internals

I'll link my response here again:

https://github.com/netbox-community/netbox/pull/13563#discussion_r1306049317

@kkthxbye-code commented on GitHub (Sep 4, 2023): > tab requires \t which is considered two characters by the sniff function internals I'll link my response here again: https://github.com/netbox-community/netbox/pull/13563#discussion_r1306049317
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8357