Problem while exporting html string to excel

Problem while exporting html string to excel

I am trying to download html string as excel. below are the screen shots

Now when I click the button download, one excel file is downloading, but when I am trying to open that file it is displaying the below error.

"Excel Cannot open the file 'abc.xlsx' because the file format or file extension is not valid. verify that the file has not been corrupted and that the file extension matches the format of the file."

Anyone help me, please. Is there anything missing in the html string?

I have solved the issue. Previously in the filename property of download, I had given the extension of the file as ".xlsx".
By giving the extension as ".xls" instead of ".xlsx", my problem got solved

hope it helps.