I want my application to go and find a csv excel file and convert it into a .xlsx file instead.
Here's what I'm currently doing;
var fileName = @"Z:328ordersPurchaseOrder.csv";
FileInfo f = new FileInfo(fileName);
f.MoveTo(Path.ChangeExtension(fileName, ".xlsx"));
var Newfile = @"Z:328ordersPurchaseOrder.xlsx";
Now this does work. It changes the file extension to my desired format. However, the file then become 'corrupt' or at least Excel refuses to open it and neither will my application when I try to venture further.
Does anyone have a solution/work-around?
See Question&Answers more detail:os