You can import configurable products in Magento 2 by CSV from the admin panel.
Select CSV from the backend,
Go To System -> Data Transfer -> Import
From Entity Type Select Products.
Select Add/Update from Import Behavior settings.
For Import Configurable product using csv, first verify its simple product exist or not in catalog, If child product is not available in catalog, You must create first its child product or Assigned all the child product in CSV before configurable product row.
You are familiar with simple product import. if you don’t know how to import simple product please refer link. How to import simple products in Magento 2?
From simple product to configurable product main difference in column are configurable_variations and configurable_variation_labels
Both column is must required to import configurable product.
configurable_variation_labels => size=Size,color=Color
Super attribute code if the configurable product made with multiple attributes keep value with comma-separated.
Example, where size, color(lowercase) is attributed code and Size and Color(attribute label)
configurable_variations => It contains the pair of all the child product SKU, super attribute value separated with PIPE(|) operator.
Example,
sku=Test_Sku,size=S,color=Red|sku=Test Simple 2,size=M,color=Blue|sku=Test Simple 3,size=L,color=White|sku=Test Simple 4,size=XL,color=Yellow
Where sku=Test_Sku, size=S, color=Red (Test_Sku is the sku and color and size value) for second product we must use pipe(|) operator and set value of second simple product and so on.
Don’t forget to run indexer command,
php bin/magento indexer:reindex