title: How To save(download ) data as excel file from response?
body: <p>I was trying to download list of data as excel file.From various posts in stackoverflow I found some help, now I m getting the data in browser as response.Now How to save(download) it in my disk as Excel file? </p>
  
  <p><strong>Note: my server does not have any MS Office installed.</strong></p>
  
  <pre><code>string attachment = "attachment; filename=city.xls";
                  Response.ClearContent();
                  Response.AddHeader("content-disposition", attachment);
                  Response.ContentType = "application/vnd.ms-excel";
                  //string tab = "";
                  //Response.WriteFile("hello World");
                  foreach (TimesAndMovementsModel item in searchParam)
                  {
  
                      Response.Write("\t" + item.CustomerName + "\t" + item.DurationInMinutes + "\t" + item.StartDate);
                      Response.Write("\n");
  
                  }
  
                  }
                  Response.End();
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/RjbNY.png" alt="enter image description here"></p>
  
  <p>Thanks.</p>