Introduction
This article gives a brief idea about how to create folders and subfolders in the SharePoint document library using power automate.
Create folders/subfolders in the SharePoint document library using Power automate
Step 1
Go to https://flow.microsoft.com/
Click on Automated--from blank.

Step 2

Step 3
Click on next, find and select the “Initialize variables” action.
Initialize variables

Step 4
Expand the Initialize variable box and assign the variable as follows,

Step 5
Click on Next Step and find and select the “Apply to Each” action.

Step 6
Inside apply for each action box, click add action and find "Create new folder", choose variable SubFolderArray as an input of Apply each action.

Step 7
Configure Create new folder action as follows,
- Choose site Address
- Choose a Library name for where need to create a folder
- Folder path represents the folder structure /ID is a root folder and /current item refers to the value from the array(for subfolders)

Step 8
Click on Save Flow.
Step 9
To test the flow, insert a record in the list that you triggered.
Step 10
Expected output,

Conclusion
That's all -- we successfully automated the folder and subfolder creation process in SharePoint document library using power automate, Cheers.

drake sucksPosted Jan 18, 2022, 8:15 PM
Hello Madhan. This does not work anymore, can you please update this?
Liam BryanPosted Aug 2, 2021, 10:25 AM
I know this issue is somewhat similar so I was wondering if you know a solution to my issue
Liam BryanPosted Aug 2, 2021, 10:24 AM
I currently have a flow which creates folders on SharePoint based on the values within an excel table which updates every day, I now need 5 sub-folders to automatically be created every time a folder is created from the previous flow mentioned. For e.g., the excel table contains account numbers, the flow I have created runs every day creating a folder for each account number, I now need sub folders called -> Contracts/Quotes/Remittance Advices/Stock/General to be created every time a new account folder is made.