A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
SharePoint's Export to Excel typically exports metadata from a list, not a hierarchical folder/file structure from a document library. That's why many online procedures don't produce the folder hierarchy you're expecting.
You would need to write custom code or use a third-party tool to export the exact folder and file structure while preserving the hierarchy. SharePoint's built-in export options typically do not provide this capability. Permissions may also be a factor, depending on the method being used.