When you export your health data. You'll get a .zip file, after expanding/unzipping it you should see a file called "export.xml"
(see screenshot)
This file probably has all the data you're looking for. Making it usable, however, seems an issue.
You could try out Apps that read the export data like https://apps.apple.com/gb/app/qs-access/id920297614, for example. (referred to in https://discussions.apple.com/thread/7960785) This app will allow you to: "Access your data from HealthKit in a table so you can explore it using Numbers, Excel, R, or any other CSV compatible tool."
If you wish to use the export.xml file instead, you could try running a script on it, depending on how comfortable you are with programming.
Hope this helps