No need for a button at all.
Just right-click what you want to export to XLS and select "Export Data".
It is as easy as that.
right clik and select export might match your requierment
Or try this extension
No I am on dev-hub and I want to develop button for exporting to excel
Sorry i can't help you for that , as i'am not a developper nor programmer
No, I'm on the dev-hub and I want to developped button to export in Excel
Retrieving data ...