Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I open a Tab delimited Text file in Excel using Perl and OLE?
    text
    copied!<p>Originally I tried to open a XML file with Excel. But as this takes ages I parsed the XML myself into a Tab delimited text file. I thought I found the correct syntax in the internet. I tried below code using the values I recorded with an Excel Macro. I have an 18 column Tab delimited file. The error occures in the last line of below code when calling "Worksheets" Method.</p> <p><strong>Error message:</strong> <em>Can't call method "Worksheets" without a package or object reference at ./PostProcessingDev.pl line 70.</em></p> <pre><code>use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; Win32::OLE-&gt;Option(Warn =&gt; 3); use strict; my $Excel; my $Sheet; my $Workbook; $Excel = CreateObject OLE "Excel.Application"; $Workbook = $Excel-&gt;Workbooks-&gt;OpenText({Filename =&gt;"$inSelf-&gt;{'TXT'}", Origin =&gt; xlMSDOS, StartRow =&gt; 1, DataType =&gt; xlDelimited, TextQualifier =&gt; xlDoubleQuote, ConsecutiveDelimiter =&gt; "False", Tab =&gt; "True", Semicolon =&gt; "False", Comma =&gt; "False", Space =&gt; "False", Other =&gt; "False", 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"}); $Sheet = $Workbook-&gt;Worksheets(1); </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