This guide is for the official Drive Explorer add-on. Install it to list, export, and audit Google Drive files and folders directly in your spreadsheet or browser.
You need to enable a config to repeat the folder name and path in every row in the Google Sheet™. Select Extensions → Drive Explorer → Configuration, check "Repeat folder names" and click on Save.
You will find this useful if you do custom filtering on the file listing.

Install Drive Explorer from the Google Workspace Marketplace today and start exporting file metadata, folder sizes, and sharing permissions directly inside Google Sheets or on your browser.