Check if excel file has any macro #514

Closed
opened 2016-12-08 22:38:31 +00:00 by kamranwali · 3 comments
kamranwali commented 2016-12-08 22:38:31 +00:00 (Migrated from github.com)

Hi,

This is not an issue, I just want to know is there a way to find out if the excel file has any macro using this library.

Hi, This is not an issue, I just want to know is there a way to find out if the excel file has any macro using this library.
wildeyes commented 2017-02-04 21:03:50 +00:00 (Migrated from github.com)

xlsm files are the only ones allowed to have macros, maybe check the file extension?

xlsm files are the only ones allowed to have macros, maybe check the file extension?
reviewher commented 2017-02-04 21:14:26 +00:00 (Migrated from github.com)

@wildeyes xls and xlsb are also permitted to have records.

For VBA macros, passing the option bookVBA:true to the read functions will set the vbaraw property of the workbook to the VBA storage if it is available.

Pre-95 Macrosheets are currently not persisted.

@wildeyes xls and xlsb are also permitted to have records. For VBA macros, passing the option `bookVBA:true` to the read functions will set the `vbaraw` property of the workbook to the VBA storage if it is available. Pre-95 Macrosheets are currently not persisted.
SheetJSDev commented 2017-10-02 01:41:10 +00:00 (Migrated from github.com)

Reading the file with the option bookVBA:true will create a key vbaraw if VBA is in the workbook. To find macrosheets, check the worksheet !type key. The full test is:

const wb_has_macro = (wb) => !!wb.vbaraw || wb.SheetNames.map(n => wb.Sheets[n]).some(ws => ws && ws['!type'] == 'macro');
Reading the file with the option `bookVBA:true` will create a key `vbaraw` if VBA is in the workbook. To find macrosheets, check the worksheet `!type` key. The full test is: ```js const wb_has_macro = (wb) => !!wb.vbaraw || wb.SheetNames.map(n => wb.Sheets[n]).some(ws => ws && ws['!type'] == 'macro'); ```
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#514
No description provided.