jack10 has asked for the wisdom of the Perl Monks concerning the following question:

Hi friends!! i am new to perl .. I have an MS Word 2003 file which contains several tables in it and I want to extract a specific table contents. For example, tables will be coming under some sections and I want to extract the contents of the table that are coming under section 6 alone and no other table contents, I want copy those contents to an new Excel sheet with formatting.
SECTION 4 Table data Table data Table data SECTION 5 Table data Table data Table data SECTION 6 Table data # TABLE DATA TO BE EXTRACTED AND IMPORTED TO AN NEW EXCEL S +HEET Table data # TABLE DATA TO BE EXTRACTED AND IMPORTED TO AN NEW EXCEL S +HEET Table data # TABLE DATA TO BE EXTRACTED AND IMPORTED TO AN NEW EXCEL S +HEET SECTION 7 Table data Table data Table data

Please help me... Thanks a lot.. i have tried using OLE::pragraphs->text to extract the word SECTION6 but i didnt get any idea how to select the table under it and copy its contents into excel.. PLS help me

  • Comment on How can I extract a specific table and copy from MS Word to Excel in Perl?
  • Download Code

Replies are listed 'Best First'.
Re: How can I extract a specific table and copy from MS Word to Excel in Perl?
by planetscape (Chancellor) on Oct 09, 2010 at 00:21 UTC
Re: How can I extract a specific table and copy from MS Word to Excel in Perl?
by davies (Monsignor) on Oct 08, 2010 at 17:48 UTC
    Yes, everyone here loves Perl, including me, but I'm not convinced it is the right tool for this. Given that you are working with two members of the MessWare Orifice Microsoft Office family, I would expect VBA to be a more efficient tool. I haven't automated Word much, but it is possible to open an instance of Word or Excel from the other. This would be a more portable solution, as it wouldn't rely on a computer having Perl with all the right modules installed. Even if you do need Perl for whatever reason, I usually find the easiest way is to write whatever VBA is needed directly, and convert it to Perl only when it's working.

    Regards,

    John Davies
      oops... thanks alot... even am finding it difficult.. can you explain this problem to me in VBA so that i will try my things to convert in perl? thanks a lot once again