I did something similar where I pre-created a table with VBA using Excel. Then I load it using the POI, fill in the values ββand then save them again. This way I get a table with filled values ββand pre-configured VB / macros, etc.
Perhaps you need to create your VBA in advance, and it will read its dynamic properties from the worksheet. You can then fill in these properties as you wish.
source share