Trouble opening an Excel file with preview
The general manner to get at logs on macOS (and OS X in the past) is to open the Console app. It shows the common application and system logging framework and allows you to search across all sources and databases that store logs.

If you are unix based - much of this logging is documented in manual pages and at developer.apple.com.

Many third party packages have documentation - like python to interact with and document logging.

Your specific needs will depend on the exact version and build of the OS and the preview app, but start with Console and consider asking a follow on question once you have specifics.

Quicklook is going to be a much harder nut to crack, since you need to know about spotlight importer details, less direct databases and layers of indirection and storage. Spotlight debugging is more of a book than an answer here as a side question.

I'd also skip excel - since that's not really an Apple product - focus on getting your file to work in Preview and you'll likely be good to go.