Import CSV files - advanced settings
Manage your CSV import files from the Data Sources' Advanced Settings tab in Productsup.
Introduction
A comma-separated values (CSV) file is a plain text file containing lists of data separated or delimited by a comma. Additionally, you can separate data in a CSV file with other delimiters as well, such as a colon (:
), semi-colon (;
), or a tilde (~
). You can refer to files where you separate columns by tabs as TSV files. You should treat TSV and CSV files similarly.
The following is an example of a typical CSV file:
id,title,price,size 1,"Red Shirt","20 EUR",Small 2,"Blue Shirt","25 EUR",Large
To import CSV files, you must add the Feed URL or Local File Import data source in Data Sources.
CSV Settings
CSV files are typically not as complex to import as JSON or XML files. In most cases, the auto-detect feature imports your file as desired.
For non-standard cases, you may have to modify some of the import settings.
Non-standard encoding
Each saved file comes with encoding, which gives you information on how to import the file's content.
The most standard encoding for CSV files is UTF-8. Other common encodings are:
UTF-16
UTF-32
ANSI
Windows-1251
Windows-1252
If your file differs from the standard, you must add this information to the platform. Defining the encoding ensures you import data as expected.
To define the encoding type:
Go to Data Sources, then select the appropriate import channel's settings cogwheel (⚙).
Next, scroll down to Content Options and CSV Settings.
From here, enter your encoding type in Encoding. See Content Options - CSV Settings for more information.
If the delimiter is not a comma
If the delimiter in your file is not a comma, you need to add this information to the platform. Defining the delimiter helps you import the data as expected.
To define the delimiter:
Go to Data Sources, then select the appropriate import channel's settings cogwheel (⚙).
Next, scroll down to Content Options and CSV Settings.
Then, enter your encoding type in Delimiter.
Non-standard enclosure
Enclose data in CSV files containing more than one word or number, for example, using quotation marks. Enclosures prevent the platform from incorrectly parsing platform data when it encounters a delimiter.
id,title,price,size,description 1,"Red Shirt","20 EUR",Small,"This is a great product, I tested it myself"
From the previous example, the written description contains a comma (,
):
This is a great product, I tested it myself.
Enclosing the description field with quotation marks tells the platform to treat the entire description as one field. If you forget the enclosure, you might import the description split into two fields:
This is a great product
I tested it myself
Use a quotation mark ("
) on either side of the data as the standard enclosure method. If you want to use another enclosure, you can define it in the platform.
To define the enclosure:
Go to Data Sources, then select the appropriate import channel's settings cogwheel (⚙).
Next, scroll down to Content Options and CSV Settings.
Then, enter your enclosure method in Enclosure.
Tip
The platform automatically removes the enclosure and does not appear in your import data.
Manage non-standard headers
A CSV file typically has a header in the first line. The header indicates the file's column names.
id,title,price,size 1,"Red Shirt","20 EUR",Small
The previous CSV example results in the following import data:
Id | Title | Price | Size |
---|---|---|---|
1 | Red Shirt | 20 EUR | Small |
You can define your header row using the Header in Row field.
If you are missing a header, add it to your feed containing all the desired column names using the Prepend Header Row.
If you want to rename your columns for the imported data directly, you can provide a new header by using the Replace Header Row field.
To edit header information:
Go to Data Sources, then select the appropriate import channel's settings cogwheel (⚙).
Next, scroll down to Content Options and CSV Settings.
Lastly, make changes as necessary to the following header fields.
Add a prefix to the attributes imported from your CSV file
If you have numerous data sources added to one site, you may need to know which attributes come from which data sources. You can distinguish between attribute sources by adding prefixes to the names of your attributes.
For example, the attribute price
imported from a data source called CSV1 can get the prefix CSV1@
for the platform to display the full name of this attribute as CSV1@price
.
To add a prefix to the names of attributes that Productsup imports from your CSV file, follow these steps:
Go to Data Sources from your site's main menu and select the cogwheel icon (⚙) next to the relevant data source.
Find the Content Options panel at the bottom of the data source setup page and select CSV Settings.
In Prepend a String to the Header Columns, enter the prefix you want to add to the names of the attributes imported from this data source.
Select Save all settings.
On the Data Sources page, open the Settings tab and modify the name of your product identifier in ID Column according to the new prefix of the relevant attribute name.
Note
You can skip this step if your site doesn't have a product identifier or your product identifier comes from a different data source with no attribute name prefix.