# How to export at xlsm file

**URL:** <https://forum.knime.com/t/how-to-export-at-xlsm-file/13779>\
**Category:** KNIME Analytics Platform\
**Tags:** excel\
**Created:** [March 11, 2019, 3:22pm UTC](https://forum.knime.com/t/how-to-export-at-xlsm-file/13779 "2019-03-11T15:22:39Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [March 11, 2019, 9:40pm UTC](https://forum.knime.com/t/how-to-export-at-xlsm-file/13779/3 "2019-03-11T21:40:11Z")

</div>

well there is a way …

You could use the R package [openxlsx](https://cran.r-project.org/web/packages/openxlsx/index.html) to add a sheet to an existing Excel file with a macro. It is not super straightforward since you first have to check if the sheet is there, the delete it, save the file, open it again and then add a worksheet, then populate it and then write the whole thing again. Cf. this [entry](https://github.com/awalker89/openxlsx/issues/256#issuecomment-281380879).

So numerous things could go wrong, but it is possible. Not sure how large the files can get. And I think the R package openxlsx is a little bit picky if you tell it to store an excel file with a macro and then there is no macro. So handle with care.

 ![image](https://forum-cdn.knime.com/uploads/default/original/2X/c/c169ce29764223dfed32e7bc757e62d021c457fc.png)

[kn\_example\_excel\_macros\_xlsm.knwf](https://forum-cdn.knime.com/uploads/default/original/2X/b/b112032bb3a5a062dc26772131f91c7eb61c27d1.knwf) (43.0 KB)

---

_[View the full topic](https://forum.knime.com/t/how-to-export-at-xlsm-file/13779)._
