in reply to Re: Saving Excel file in Tab delimeted text or .csv
in thread Saving Excel file in Tab delimeted text or .csv
Thanks for your feedback, this helped me save my .xls file as a tab delimited text file. The link to the MSDN Excel 2007 doc is very helpful. Sorry about the formatting, let me know if there are any more issues. I also would like to thank graff and cbu for their reply. After spending upwards of three days trying to figure this out, I should have asked a question sooner. Hopefully I can become proficient at Perl enough to help others. A modest donation has been sent to the Perl Monks. I did run into an issue where a dialog prompt comes up asking if I want to save the .txt file. I remembered another question I came across while trying to solve the format issue and was able to leverage off of it to eliminate the dialog prompt by adding "$Excel->{DisplayAlerts} = "False";" to the script. <s # Saves C:\\work\\perl_WinOle\\sym_text_testdoc.xls as a text or # MSDOS text formatted document. (Tab delimited) use Win32; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; #$file = "C:\\work\\perl_WinOle\\test.csv"; $OutFile = "C:\\work\\perl_WinOle\\sym_text_testdoc.txt"; my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); my $xl = Win32::OLE::Const->Load($Excel); #$Excel->{'Visible'} = 1; # if you want to see what's going on my $Book = $Excel->Workbooks->Open( "C:\\work\\perl_WinOle\\sym_text_t +estdoc.xls" ); $Book->Activate(); $Excel->{DisplayAlerts} = "False"; $Book->SaveAs($OutFile, xlTextMSDOS); #$Excel->{DisplayAlerts} = "False"; $Book->Close(); $Excel->Quit(); e> Thanks for your help and have a great weekend. Steve Bell
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Saving Excel file in Tab delimeted text or .csv
by NetWallah (Canon) on May 30, 2008 at 20:48 UTC |