Magento – Import a csv file in Bo magento 2

csvimportmagento2

We have prepared a script that convert the csv of product that belong to our customer then we converted to the format that magento accepted (mapping of attributs with some condition on attributs to have configurable product) but when i import the csv i get errors :
Data validation failed. Please fix the following errors and upload the file again.

Following Error(s) has been occurred during importing process: Only the first 100 errors are shown. Download full report
1. Value for 'product_type' attribute contains incorrect value, see acceptable values on settings specified for Admin in row(s): 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101 Checked rows: 101, checked entities: 101, invalid rows: 100, total errors: 100

i found the errors that say : the "x", y , z attributes are invalid

and some times i get this error:

Duplicates found in column names: array ( 0 => 'sku', 1 => 'store_view_code', 2 => 'attribute_set_code', 3 => 'product_type', 4
=> 'categories', 5 => 'product_websites', 6 => 'name', 7 => 'description', 8 => 'short_description', 9 => 'weight', 10 => 'product_online', 11 => 'tax_class_name', 12 => 'visibility', 13 => 'price', 14 => 'special_price', 15 => 'special_price_from_date', 16 => 'special_price_to_date', 17 => 'url_key', 18 => 'meta_title', 19 => 'meta_keywords', 20 => 'meta_description', 21 => 'base_image', 22 => 'base_image_label', 23 => 'small_image', 24 => 'small_image_label', 25
=> 'thumbnail_image', 26 => 'thumbnail_image_label', 27 => 'swatch_image', 28 => 'swatch_image_label', 29 => 'created_at', 30 => 'updated_at', 31 => 'new_from_date', 32 => 'new_to_date', 33 => 'display_product_options_in', 34 => 'map_price', 35 => 'msrp_price', 36 => 'map_enabled', 37 => 'gift_message_available', 38 => 'custom_design', 39 => 'custom_design_from', 40 => 'custom_design_to', 41 => 'custom_layout_update', 42 => 'page_layout', 43 => 'product_options_container', 44 => 'msrp_display_actual_price_type', 45 => 'country_of_manufacture', 46 => 'additional_attributes', 47 => 'qty', 48 => 'out_of_stock_qty', 49 => 'use_config_min_qty', 50 => 'is_qty_decimal', 51 => 'allow_backorders', 52 => 'use_config_backorders', 53 => 'min_cart_qty', 54 => 'use_config_min_sale_qty', 55 => 'max_cart_qty', 56 => 'use_config_max_sale_qty', 57 => 'is_in_stock', 58 => 'notify_on_stock_below', 59 => 'use_config_notify_stock_qty', 60 => 'manage_stock', 61 => 'use_config_manage_stock', 62 => 'use_config_qty_increments', 63 => 'qty_increments', 64 => 'use_config_enable_qty_inc', 65 => 'enable_qty_increments', 66 => 'is_decimal_divided', 67 => 'website_id', 68 => 'related_skus', 69 => 'related_position', 70 => 'crosssell_skus', 71 => 'crosssell_position', 72 => 'upsell_skus', 73 => 'upsell_position', 74
=> 'additional_images', 75 => 'additional_image_labels', 76 => 'hide_from_product_page', 77 => 'bundle_price_type', 78 => 'bundle_sku_type', 79 => 'bundle_price_view', 80 => 'bundle_weight_type', 81 => 'bundle_values', 82 => 'bundle_shipment_type', 83 => 'configurable_variations', 84 => 'configurable_variation_labels', 85 => 'associated_skus', 86 => '', 87
=> '', )

enter image description here

enter image description here

Best Answer

I found the solution to the same problem you were having. I was working in Excel and saving the page with the column headers and data as a CSV file. What I did not see was that Excel must have had a space or something in the last two unused columns and when the file was saved as a CSV file it created two additional comma delimited fields with nothing in them. The "duplicates" that were found during the validation were only the last two fields both being blank. You can see 86=> and 87=> above are blank. Now before I "Save As", UTF-8, I select all the valid columns and that insures there is no "blank" columns to fail the validation. In addition, I open the resultant CSV file with Notepad++, select Encoding on the top menu, select Encode in UTF-8 (no BOM) then Save. That solved my problem, hopefully yours as well.

Related Topic