I have an application that can import data from an Excel (.xls) spreadsheet. This spreadsheet is in turn imported from a CSV file, which provides a template for data. The user then populates the template, saves it as an .xls file, and imports it into the application.
My problem is that the application that imports the spreadsheet expects a sheet called Sheet1, but when the user opens the CSV template, Excel 'imports' the CSV data into a and automatically created worksheet with the same name as the CSV file. Example:
- Application X creates a template file called January.csv
- User opens January.csv in Excel, which creates a worksheet called January. They populate this worksheet, and save the workbook as MonthlyData.xls
- Application Y attempts to import data from Sheet1 in MonthlyData.xls, and fails.
I would like to find some way of telling Excel that when it opens a CSV file, it must automatically rename the first worksheet it creates to Sheet1, and not give that sheet the same name as the CSV file, as it does by default. What means are at my disposal for doing this?