Export SharePoint online list to Excel

I know that there is an OOTB feature to export the list to an .iqy file that can be opened in Excel.

But here we want to export the list using JSOM / REST to a file in .xls format. I've reviewed some articles online, but I can not find any way to fill it. Everywhere, the code is either exported in csv format, or the code behind the "Export to Excel" button that downloads the .iqy file.

Is there a way to do this?