Hello,
It should use Amazon AWS Product Advertising API where you should entry the main categories on Amazon Stores and let the API code I will write for you to query the sub categories recursively. This will take some moments as Amazon limits the number of request per secs you allowed. But, if you need it just the name of subs categories, this will be quick.
I will use VBA code so it can be ported to the Excel worksheet directly.
Best Regards,
Khamid