Reputation: 7884
I'm having a problem with the Worksheet tab being renamed to whatever the file name is. The problem with this is if a user accidentally downloads the sheet twice, Windows appends template(1).csv to the file to maintain uniqueness in their download directory. When opened in Excel, this sheet has a tab name of template(1).csv - as it assumes the file name.
//This code correctly downloads a CSV file - but how can I pass in the tab name???
context.Response.Clear();
context.Response.ContentType = "text/comma-separated-values";//"application/vnd.ms-excel";
context.Response.AppendHeader("Content-Disposition", "attachment;filename=template.csv");
context.Response.Write(csvString);
context.Response.End();
Thanks!
Upvotes: 2
Views: 3625
Reputation: 30902
The problem is that CSV files do not contain sheets, Excel just makes them look like they do.
Whatever the name of the .csv file is, excel will use that to populate the sheet name thingy.
Upvotes: 5