Seems like its pretty easy to do this by CSV
Something like:
Parent Category | Subcategory
Where you can create an infinite tree of categories based on the name by just looping over the rows in a CSV.
ie: If subcategory is blank create a new top level category. Otherwise create a subcategory of the category with the matching name for parent category.
This assumes you don't have any duplicate categories anywhere in the tree.