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

need to modify the customer data import template that is to be uploaded into quickbooks pos. i believe this needs to be done through an win32::ole excel object but not sure where to go from there. is there anyone that knows anything about quickbooks pos importing, or spreadsheet modification with win32::ole? any help with this would be greatly appreciated!
  • Comment on insert into excel spreadsheet using win::ole excel object

Replies are listed 'Best First'.
Re: insert into excel spreadsheet using win::ole excel object
by Grygonos (Chaplain) on Feb 19, 2004 at 20:35 UTC

    Since it is a little qwirky getting started with OLE, here is some tested and verified barebones code to put a value in a cell of an excel sheet(using the default Book1.xls that is created when you open a new document in Excel.

    Referencing the afformentioned documentation in excel will help explain how to accomplish the rest.

    #!/perl -w use strict; use Win32::OLE; my $excel = new Win32::OLE('Excel.Application'); my $workbook = $excel->Workbooks->Open("Book1.xls"); $workbook->Worksheets('Sheet1')->Range('A1')->{Value} = 'perl writing +to Excel'; $workbook->Save(); $excel->Quit();


    Grygonos
      that worked great. thanks. i also tried this:

      $worksheet->Cells(1,1)->{Value} = "foo";
Re: insert into excel spreadsheet using win::ole excel object
by maa (Pilgrim) on Feb 19, 2004 at 19:20 UTC

    Of course, a Super Search for Win32::OLE and Excel reveals rather a lot of nodes, too... but if you have Excel installed the simplest way of learning how to "Automate" stuff is to use it's Macro Recording function (Tools Menu) and then hit ALT+F11 to view the code it recorded...

    HTH - Mark

Re: insert into excel spreadsheet using win::ole excel object
by fizbin (Chaplain) on Feb 19, 2004 at 18:48 UTC
Re: insert into excel spreadsheet using win::ole excel object
by bear0053 (Hermit) on Feb 19, 2004 at 18:28 UTC
    if you installed activestate, i would check out the OLE browser that was installed with it. Look at the Microsoft Excel 10.0 Object Library
    this will provide you with methods and properties you can use to manipulate excel files.