can you try this way
public HttpResponseMessage Get()
{
string str = "<table><tr> <th>colume1</th></tr><tr> <td>abc</td> </tr></table>";
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new StringContent(str);
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.ms-excel");
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
result.Content.Headers.ContentDisposition.FileName = "data.xlsx";
return result;
}