Often when we import files we run into errors that the file is not being read correctly. Where to start looking for the cause of the issue and how to solve this?
Follow these checkpoints to make sure that you have the basics right.
- Up-to-date Available Fields
The list of available fields should be up-to-date before importing starts. If the field list is not up-to-date the import may fail due to missing fields. To update the list of available fields go to Maintenance -> Available Fields -> Click Update
- A clean CSV file
A CSV file should not have any extra characters in any place. A good CSV file may look like this:
A bad CSV file may look like this:
"product_sku,product_name" <-- The " at the beginning and end of the line are wrong
product_sku,product_name, <-- The trailing comma is wrong
The template must use the same delimiters as your file has. The type of delimiters does not matter. To know what delimiters your file uses look at your file with Notepad for example.
Some examples of delimiters are:
Sample Field delimiter Text enclosure "product_sku","product_name" , " ~product_sku~^~product_name~ ^ ~ product_sku|product_name |
Check that you have the delimiters filled in your template settings. CSVI needs this to know how to read the CSV file. Alternatively you can use the Automatic delimiter detection.
The file must always be encoded in UTF-8 format. No other encoding is supported. See this Save file as UTF-8 using Notepad2 video on how to save your file as UTF-8 using Notepad2 or this tutorial using LibreOffice/OpenOffice. This is important because files imported not in UTF-8 encoding will not import correctly with special characters like ë and sentences will be cut off.
- Field names
Use only fieldnames that are available for the type of import you are doing. To see which fieldnames are available go to CSVI ---> Available Fields and filter on the type of import you want to do. It is not possible to use any other name. This means that if your CSV file contains the names sku, price, name that these cannot be used, you have to translate them to CSVI fieldnames. Your column names will change like this:
- sku --> product_sku
- price --> product_price
- name --> product_name
This needs to be done for all the fields in your file.
- Field data
Make sure the data is properly formatted according to the specifications. Information on the fields can be found on the Visual Available Fields pages.
- Line endings
It is best to use Unix or Windows line endings. Mac line endings can give issues, by default they are not supported by PHP. If you have Mac line endings, you can select the option I'm Mac in your template, this will tell CSVI to try to read Mac line endings.
- Use the CSVI Analyzer to check your file for any issues. The CSVI Analyzer is included in CSVI and can be found by going to Components -> CSVI Pro -> Maintenance -> Analyzer.
- Check the debug information
The debug report shows every step CSVI takes when importing the file. See the How to collect debug information on how to get your debug report. Check the debug information for anything that might be going wrong or post it in the forum.
After having checked these checkpoints your import should be running smoothly. Check out also this Preparing your CSV file tutorial on how to prepare your CSV file.