Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating a .csv file that will import to multiple worksheets
If you are asking if Excel can do this on it own, then the answer is No:
Excel expects all data in a such file to be in the same format and will import to single worksheet. You can of course cut/paste (either manually or in code) to produce the desired result. Otherwise you will need to Open the file (check the VBA help for the Open Statement), read a line and decide which file you are in from the header info, then read line by line, unless the header tells you how many lines/bytes you need to deal with. If you can get the output file correctly formatted in Excel's version of ..csv, Excel can open .csv file directly, so no need for the steps. NickHK "mastermind" wrote in message ... I have the following workflow: 1. An application program is creating several .csv files which have header information on the 1st line and data on the subsequent lines. There are approximately 4 of these files. 2. In Excel, the users open each .csv file separately and go through the format prompt to display the contents in a worksheet. Question - can I create single CSV file that contains all 4 files(with different column formats) that can be imported into Excel as separate worksheets? Thx. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating a .csv file that will import to multiple worksheets
I meant that if you can the output csv files in the format that Excel
expects for csv files, there would be no need for the user to go through the wizard as they would open directly in Excel as a worksheet. NickHK "mastermind" wrote in message ... Thx. This is what I had thought, that the only way to do this would be if the user had a pre-written macro that would parse the combined file creating separate worksheets. I am curious as to your last statement about getting it into the 'correct' csv format of Excel - how could I determine this format? Would I save a workbook with multiple sheets as a csv? I thought that the csv export is by worksheet only. Any help would be appreciated. "NickHK" wrote: If you are asking if Excel can do this on it own, then the answer is No: Excel expects all data in a such file to be in the same format and will import to single worksheet. You can of course cut/paste (either manually or in code) to produce the desired result. Otherwise you will need to Open the file (check the VBA help for the Open Statement), read a line and decide which file you are in from the header info, then read line by line, unless the header tells you how many lines/bytes you need to deal with. If you can get the output file correctly formatted in Excel's version of ..csv, Excel can open .csv file directly, so no need for the steps. NickHK "mastermind" wrote in message ... I have the following workflow: 1. An application program is creating several .csv files which have header information on the 1st line and data on the subsequent lines. There are approximately 4 of these files. 2. In Excel, the users open each .csv file separately and go through the format prompt to display the contents in a worksheet. Question - can I create single CSV file that contains all 4 files(with different column formats) that can be imported into Excel as separate worksheets? Thx. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How 2 import Excel file w/ multiple worksheets ??? | Excel Discussion (Misc queries) | |||
how can i import worksheets from multiple workbooks | New Users to Excel | |||
Import one column of data from multiple Excel worksheets | Excel Programming | |||
Amalgamate Several Worksheets into one file thru Data import | Links and Linking in Excel | |||
Amalgamate Several Worksheets into one file thru Data import | Excel Discussion (Misc queries) |