Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
running text import wizard through c#
I have a data file that I need to download and convert from text to xls to
then do further manipulation. When I manually fire up excel, open the text file and leave all the text import wizard defaults I can then work with the resulting xls file programmatically. When I use the following code I get errors when I try to open the resulting xls file. I haven't been able to find much about the different options in the OpenText file command so I'm not sure what properties I'm setting incorrectly that the wizard automatically sets correctly. It's a tab delimited file. Can anyone tell me what options I need to set to get it converted correctly? Thanks. Excel.Application application = new Excel.Application(); object missing = System.Reflection.Missing.Value; System.Threading.Thread.CurrentThread.CurrentCultu re = new CultureInfo("en-US"); System.Threading.Thread.CurrentThread.CurrentUICul ture = new CultureInfo("en-US"); application.Caption = "Test"; application.Visible = true; application.Workbooks.OpenText ( sFileToSave, missing, 1, Excel.XlTextParsingType.xlDelimited, Excel.XlTextQualifier.xlTextQualifierNone, missing, true, //TAB missing, false, //COMMA missing, missing, missing, missing, missing, missing, missing, missing, missing ); application.Save(sExcelToSave); application.Quit(); application = null; |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Text Import Wizard | Excel Discussion (Misc queries) | |||
How to Start Excel in Text Import Wizard for data import | Setting up and Configuration of Excel | |||
Text Import Wizard | Excel Discussion (Misc queries) | |||
Text Import Wizard | Excel Discussion (Misc queries) | |||
Text Import Wizard from vba | Excel Programming |