This tutorial explains how to import magento 2 categories programmatically. The script read category details from the CSV and create categories programmatically.
The import script create categories and subcategories as shown below.Please find out how to import magento 2 products programmatically and other magento tutorials.