In Word, use the multi level numbering for the headings (just change the level 1 heading style to apply multi-level numbers and all other heading styles will adapt the numbering). Now all headings will have numbers like 2, 2.1, 2.2.2, followed by the heading text.
Next, create a table of contents, which will have only the headings. Use the first style in the list of TOC styles in the dialog. By default, a TOC contains only headings up to four levels, so you may need to change the heading styles if you want to include more levels in the TOC.
Copy the TOC and paste it into Excel, using Paste Special > Unicode text. The paste result will be three columns, i.e. the number of the heading, the heading text and the page number. Select the number column and set its format to "Text". If you don't do that, the following will not work.
Use formulas to calculate the level according to the dots in the numbers column. Then use formulas to pull the text into different columns accordingly, as shown below.
In the following screenshot, the level is calculated with the formula (in E2, copied down)
=LEN(A2)-LEN(SUBSTITUTE(A2,".",""))+1
The formula in F2 is
=IF($E2=F$1,$B2,"")
copied across and down.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/0I3wn.png)