Add toxlsm function
carlcorder opened this issue · 2 comments
carlcorder commented
Would it be possible to create a toxlsm
function that basically wraps toxlsm
but passes keyword args (specifically keep_vba=True
) down to _load_or_create_workbook so that saving a .xlsm file is possible?
I did a quick search of all the issues and didn't see anything on this. My apologies if it has already been discussed.
juarezr commented
It looks good to me:
- I don't know any previous attempt at coding this feature.
- It's a nice feature for adding in
petl
. - It can be done in a few different ways:
- a parameter here can work.
- a new function named
toxlsxm
. - Maybe both
- There are some considerations for choosing the best approach like:
- It should have a default value for preserving current behavior
- It shouldn't break existing code
- It's should be flexible for extending to further options for related functionality, like another format or behavior
E.g.:
def toxlsx(tbl, filename, sheet=None, write_header=True, mode="replace", format="xlsx"):
""" - `format`: xlsx (default), xlsm"""
###
def toxlsxm(tbl, filename, sheet=None, write_header=True, mode="replace"):
""" Write a table to a new Excel .xlsxm file with macro/VBA enabled."""
###
Patches welcome!
carlcorder commented
@juarezr, thanks for the response/feedback! I'll see what I can come up with and create a PR.