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.
![Automated--from blank]()
Step 2
![Build Automated cloud flow]()
Step 3
Click on next, find and select the “Initialize variables” action.
Initialize variables
![Initialize variable in Power Automate]()
Step 4
Expand the Initialize variable box and assign the variable as follows,
![Initialize variable]()
Step 5
Click on Next Step and find and select the “Apply to Each” action.
![Apply to Each]()
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.
![Creating folder and sub folder in Sharepoint library using power automate]()
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)
![Dynamic content]()
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,
![Creating folder and sub folder in Sharepoint library using power automate]()
Conclusion
That's all -- we successfully automated the folder and subfolder creation process in SharePoint document library using power automate, Cheers.