Closed indra-sen-morrisonsplc closed 1 year ago
Reading worksheets from macro-enabled files (XLSM, XLSB, XLS) should "just work". If there is a specific file causing issues, please share it here or via email and we can take a closer look and reopen the issue.
Any condition missing in my if statement specifically meant to validate or look for a macro enabled file ? @SheetJSDev Please share. Currently using this condition to read a xls file which does not reads data from a macro enabled file.
if (
placeholderFile &&
(placeholderFile.type === 'text/csv' ||
placeholderFile.type === 'application/vnd.ms-excel' ||
placeholderFile.type ===
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
) {
console.log(placeholderFile)
import('xlsx').then((xlsx) => {
const reader = new FileReader()
reader.onload = (event: any) => {
const wb = xlsx.read(event.target.result, { type: 'array' })
const wsname = wb.SheetNames[0]
const ws = wb.Sheets[wsname]
const data = xlsx.utils.sheet_to_json(ws)
console.log(data)
const data1 = xlsx.utils.sheet_to_json(ws, { header: 1 })
const cols: any = data1[0]
const json = JSON.parse(
JSON.stringify(data).replace(/"\s+|\s+"/g, '"')
)
return result
}
You can always just print out the type just before the if statement :) console.log(placeholderFile.type)
application/vnd.ms-excel.sheet.macroEnabled.12
is the official MIME type for XLSM.
See https://docs.microsoft.com/en-us/previous-versions/office/office-2007-resource-kit/ee309278(v=office.12) for a full list
Hello SheetJS/sheetjs, I have attached a macro enabled file with you which I am facing issues to read the data from. Kindly look into it and please share some solution. Thanks and Regards, Indrasen
On Wed, 7 Sept 2022 at 01:55, SheetJSDev @.***> wrote:
Reading worksheets from macro-enabled files (XLSM, XLSB, XLS) should "just work". If there is a specific file causing issues, please share it here or via email and we can take a closer look and reopen the issue.
— Reply to this email directly, view it on GitHub https://github.com/SheetJS/sheetjs/issues/2784#issuecomment-1238614583, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2P3JVC2CUEXNMZ3ED5CQ5DV46SCNANCNFSM6AAAAAAQGE5XYU . You are receiving this because you authored the thread.Message ID: @.***>
--
Please note that Wm Morrison Supermarkets PLC is now Wm Morrison Supermarkets Limited. Please amend your records accordingly.
Wm Morrison Supermarkets Limited is registered in England with number 358949. The registered office of the company is situated at Gain Lane, Bradford, West Yorkshire BD3 7DL. This email and any attachments are intended for the addressee(s) only and may be confidential.
If you are not the intended recipient, please inform the sender by replying to the email that you have received in error and then destroy the email.  If you are not the intended recipient, you must not use, disclose, copy or rely on the email or its attachments in any way.
This email does not constitute a contract in writing for the purposes of the Law of Property (Miscellaneous Provisions) Act 1989.
Our Standard Terms and Conditions of Purchase, as may be amended from time to time, apply to any contract that we enter into. The current version of our Standard Terms and Conditions of Purchase is available at:http://www.morrisons.co.uk/gscop http://www.morrisons.co.uk/gscop
Although we have taken steps to ensure the email and its attachments are virus-free, we cannot guarantee this or accept any responsibility, and it is the responsibility of recipients to carry out their own virus checks.
It's not an issue but just a requirement where I need to read data from a Macro file. The Sheet JS is working smoothly with normal xlsx format file but unable to read data from a macro file. Please help.