Get Section name via sectionId

I want to know the section name, i.e the name we set via the “right click menu > rename section”. I am able to get the section id. If I do $w(‘#sectionId’).name, it is returning empty/blank.

I need this because I am creating an horizontal in-page menu and hence need the section names. The vertical in-page menu does not suit my UI/UX, hence this post.

Thank You