Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Problems with Microsft's new Office 'XML'

by terra incognita (Pilgrim)
on Oct 04, 2005 at 17:34 UTC ( [id://497345]=note: print w/replies, xml ) Need Help??


in reply to Problems with Microsft's new Office 'XML'

You are referencing the "xls" file which is still binary. Change your filename to "spreadsheet.xml" and save the file as xml.

Using your first script with an "xls" file causes the error you see, however when I use it on the same file saved as "xml" it does not report an error.

Update

Here is some code to dump the xml file.

use strict; use warnings; use XML::Simple qw(:strict); use Data::Dumper; my $config = XMLin('./Book1.xml',forcearray => 1,keyattr => ['']); print Dumper($config);

Replies are listed 'Best First'.
Re^2: Problems with Microsft's new Office 'XML'
by graq (Curate) on Oct 05, 2005 at 07:39 UTC
    You are referencing the "xls" file which is still binary. Change your filename to "spreadsheet.xml" and save the file as xml.

    OK. This is meant to be an automated process, removing the human interaction - how do I do this with Perl?

      As always, you do this by using Win32::OLE to automate Excel.

      The steps are the usual six steps:

      1. Start the Excel Macro Recorder
      2. Perform the desired action(s) manually, in your case, save the file as XML
      3. Stop the Excel Macro Recorder
      4. Inspect the generated VB code
      5. Check that the generated VB code does what you want
      6. Translate the generated VB code to Perl / Win32::OLE invocations

      There are many examples on this website which should give you a good start on how to do the translation. It consists mostly of s!\.!->! applied to every line of the code, and you will have to exchange the global properties like "ActiveWorkSheet" by the local values you get from $excel->OpenFile().

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://497345]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-23 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found