2023 Nov 28 11:51 AM
I want to know, is there any difference between writing data to a new Excel file and an existing Excel file?
I am able to write data to a new Excel file (create new file). But unfortunately, I am not able to write data to an existing Excel file without changing of data in other sheets of that file.
If somebody could give me some advice or an example code, that would be great. Thanks in advance.
2023 Nov 28 12:32 PM
You need to read the Excel file first, make the changes you want, then write the file back (see zdemo_excel37 demo)
Be aware that there might, very rarely, be unintended changes: if the file is complex and you simply want to fill in some values in an existing template file, you could also check the zdemo_excel_fill_template demo.
2023 Nov 29 10:21 AM
c5e08e0478aa4727abc4482f5be390b2, thank you for your reply.
Now I can write data to an existing Excel file. Just I don't know why, but after writing data it will remove styles from other sheets.
For example: I have the below Excel file with sheet2, but after writing data to a new sheet, it will remove table style from sheet2.
2023 Nov 29 2:15 PM
hamida_ashna
Not possible to answer if you don't explain how you generated the Excel file. Is it obtained by just running zdemo_excel37 or by custom code? You must initialize the style of course.
2023 Nov 30 9:42 AM
2023 Nov 30 9:44 AM
sandra.rossi, can you please tell me how to initialize the style
2023 Dec 02 8:43 PM
2023 Dec 03 9:03 AM
hamida_ashna The abap2xslx demos repository is full of examples. Use either Github or RS_ABAP_SOURCE_SCAN to search anything related to "style".
2023 Dec 23 6:32 PM
sandra.rossi, can please give me advice.
As I mentioned my problem, after reading the file using zcl_excel_reader_2007, I found it that the reader is not able to read style of tables in a sheet (reader can read other styles but can't load table style). Can you please tell me how to fix this issue or how to initialize the style of table?
I checked the abap2xslx demos repository, but didn't find anything related to this issue.
2023 Dec 23 7:05 PM
hamida_ashna abap2xlsx was created by volunteer ABAP developers and is missing lots of features.
Please create the minimal reproducible example = one very simple Excel file + one very simple program that you attach to a New Issue · abap2xlsx/abap2xlsx (github.com) and I'll look into it.