<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Write in an Excel File in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618403#M1088091</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;I have this problem: I have to write some informations in an excel file; the excel is not empty with SAP data I have to fill some cells of the "template" xls file. I know how to CREATE an excel file in its aspects, but I can't find a way for OPEN an existing file, modifying it and then save it (in a new file for example); this is my code; I can't see where is the error:&lt;/P&gt;&lt;P&gt;(in path_wb and in full_path there are the path for template input file and the path for the output file)&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;" excel data
  DATA excel TYPE ole2_object.
  DATA workbook TYPE ole2_object.
  DATA sheet TYPE ole2_object.
  DATA cell TYPE ole2_object.

  " create object to execute the application
  CREATE OBJECT excel 'EXCEL.APPLICATION'.
  " open the workbook
  CALL METHOD OF excel 'Workbooks' = workbook.
  CALL METHOD OF workbook 'OPEN' EXPORTING #1 = path_wb.
  " open the sheet
  CALL METHOD OF excel 'WORKSHEETS' = sheet.
  CALL METHOD OF sheet 'OPEN' EXPORTING #1 = 'Taxonomy'.

  " seek one cell
  CALL METHOD OF excel 'RANGE' = cell EXPORTING #1 = 'D10'.
 " put something in it
  SET PROPERTY OF cell 'VALUE' = 'DATO AGGIUNTO'.

  " store file
  CALL METHOD OF workbook 'SAVEAS'
    EXPORTING
    #1 = fullpath
    #2 = 1.
  CALL METHOD OF workbook 'CLOSE'.
  CALL METHOD OF excel 'QUIT'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;has anyone do it before?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Oct 2008 15:53:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-23T15:53:51Z</dc:date>
    <item>
      <title>Write in an Excel File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618403#M1088091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;I have this problem: I have to write some informations in an excel file; the excel is not empty with SAP data I have to fill some cells of the "template" xls file. I know how to CREATE an excel file in its aspects, but I can't find a way for OPEN an existing file, modifying it and then save it (in a new file for example); this is my code; I can't see where is the error:&lt;/P&gt;&lt;P&gt;(in path_wb and in full_path there are the path for template input file and the path for the output file)&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;" excel data
  DATA excel TYPE ole2_object.
  DATA workbook TYPE ole2_object.
  DATA sheet TYPE ole2_object.
  DATA cell TYPE ole2_object.

  " create object to execute the application
  CREATE OBJECT excel 'EXCEL.APPLICATION'.
  " open the workbook
  CALL METHOD OF excel 'Workbooks' = workbook.
  CALL METHOD OF workbook 'OPEN' EXPORTING #1 = path_wb.
  " open the sheet
  CALL METHOD OF excel 'WORKSHEETS' = sheet.
  CALL METHOD OF sheet 'OPEN' EXPORTING #1 = 'Taxonomy'.

  " seek one cell
  CALL METHOD OF excel 'RANGE' = cell EXPORTING #1 = 'D10'.
 " put something in it
  SET PROPERTY OF cell 'VALUE' = 'DATO AGGIUNTO'.

  " store file
  CALL METHOD OF workbook 'SAVEAS'
    EXPORTING
    #1 = fullpath
    #2 = 1.
  CALL METHOD OF workbook 'CLOSE'.
  CALL METHOD OF excel 'QUIT'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;has anyone do it before?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 15:53:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618403#M1088091</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T15:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Write in an Excel File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618404#M1088092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look on this: [ABAP - Upload data from Excel to Sap using OO |https://wiki.sdn.sap.com/wiki/x/xOw]. This wiki shows how to access certain excel cell and spreadsheets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 17:23:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618404#M1088092</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T17:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Write in an Excel File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618405#M1088093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok&lt;/P&gt;&lt;P&gt;I found it: the error was the way I was opening the sheet. for opening the sheet the correct way is this:&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA sheet_name(51).
  WHILE sheet_name &amp;lt;&amp;gt; 'THE_SHEET_NAME_I_WANT_TO_OPEN'.
    CALL METHOD OF excel 'Worksheets' = sheet EXPORTING #1 = sy-index.
    GET PROPERTY OF sheet 'Name' = sheet_name.
  ENDWHILE.
CALL METHOD OF sheet 'Activate'.

  " now I can manipulate the sheet as I want
  CALL METHOD OF excel 'RANGE' = cell EXPORTING #1 = 'D10'.
*  PERFORM set_title.
  SET PROPERTY OF cell 'VALUE' = 'Data added On Existing Sheet'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Oct 2008 08:13:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618405#M1088093</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-24T08:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Write in an Excel File</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618406#M1088094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Oct 2008 08:14:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/write-in-an-excel-file/m-p/4618406#M1088094</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-24T08:14:15Z</dc:date>
    </item>
  </channel>
</rss>

