Posted 2 June 2022, 12:09 am EST
Is it possible, to copy / clone a Workbook object in-memory? My use case is, that I have a template Excel file, which must be filled with data from another system. This template workbook can be pretty complex, so it can take a few seconds to read the template from the file system. When I have many files to process, the code always reads the same template, again and again. I think, it might be a lot faster, if the file is read / parsed only once, and the resulting workbook is then just cloned instead of loaded as *.xlsx(m) file.
I know I can copy worksheets from one workbook to another. But I have found nothing, that copies the entire workbook, including the unparsed, but preserved information such as OLE objects, VBA macros and custom XML. Is there any way to achieve that?