Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Thanks for at all for your answers. This resolved my issue. All I wanted to do with the OpenText method was to convert a TSV file to Excel as this is the result format I require. As I couldn't find a solution on the web before I like to provide the complete code:</p> <pre><code>use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; use strict; Win32::OLE-&gt;Option(Warn =&gt; 3); my $FileName = "Complete Path of TSV File"; my $Excel = Win32::OLE-&gt;new("Excel.Application"); # Open Tab separated Text file in Excel, all 18 columns are "Text" formated $Excel-&gt;Workbooks-&gt;OpenText({ Filename =&gt; $FileName, Origin =&gt; xlMSDOS, StartRow =&gt; 1, DataType =&gt; xlDelimited, TextQualifier =&gt; xlDoubleQuote, Tab =&gt; "True", FieldInfo =&gt; [[1, xlTextFormat], [2, xlTextFormat], [3, xlTextFormat], [4, xlTextFormat], [5, xlTextFormat], [6, xlTextFormat], [7, xlTextFormat], [8, xlTextFormat], [9, xlTextFormat], [10, xlTextFormat], [11, xlTextFormat], [12, xlTextFormat], [13, xlTextFormat], [14, xlTextFormat], [15, xlTextFormat], [16, xlTextFormat], [17, xlTextFormat], [18, xlTextFormat]], TrailingMinusNumbers =&gt; "True" }); my $Sheet = $Excel-&gt;ActiveWorkbook-&gt;Worksheets(1); $Sheet-&gt;Activate; my $Workbook = $Excel-&gt;ActiveWorkbook; # Replace the "*.txt" file extension by "*.xls" for Excel $FileName =~ s/txt$/xls/; # Turn off the "This file already exists" message. $Excel-&gt;{DisplayAlerts} = 0; # Save file as Excel 2000-2003 Workbook (command for Excel 2007) $Workbook-&gt;SaveAs({Filename =&gt; $FileName, FileFormat =&gt; xlExcel8}); $Excel-&gt;Quit; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload