Open GX158 opened 1 year ago
@GX158 Has this problem been solved? I have this problem now, I remember around 2022-July, I tried to be able to parse the encrypted excel, I don't know why it suddenly doesn't work now, I am using wps to create the excel file with password encryption?
@GX158 I tried again, office excel new with password can be decrypted, wps can not. If you use wps to open the new excel file with password created by office excel and then save it, then use xlsx-populate also can not decrypt it, it should be wps to save some content format changes, resulting in xlsx-populate also can not be decrypted
@GX158 You can try @zurmokeeper/exceljs https://www.npmjs.com/package/@zurmokeeper/exceljs
// read from a file, decrypt excel files encrypted with password
const workbook = new Excel.Workbook();
await workbook.xlsx.readFile(filename, {password:'123456'});
// ... use workbook
xlsx-populate only supports ecma376 agile encrytion, not ecma376 standard encrytion, this library supports both encryption methods
when i open the xlsx file ,the system occurs some error like this:
[Running] node "e:\js_project\decipher-excel\test.js" Error: Non-whitespace before first tag. Line: 0 Column: 1 Char: � at error (e:\js_project\decipher-excel\node_modules\sax\lib\sax.js:651:10) at strictFail (e:\js_project\decipher-excel\node_modules\sax\lib\sax.js:677:7) at beginWhiteSpace (e:\js_project\decipher-excel\node_modules\sax\lib\sax.js:951:7) at SAXParser.write (e:\js_project\decipher-excel\node_modules\sax\lib\sax.js:1006:11) at e:\js_project\decipher-excel\node_modules\xlsx-populate\lib\XmlParser.js:72:20 at new Promise ()
at XmlParser.parseAsync (e:\js_project\decipher-excel\node_modules\xlsx-populate\lib\XmlParser.js:20:16)
at Encryptor._parseEncryptionInfoAsync (e:\js_project\decipher-excel\node_modules\xlsx-populate\lib\Encryptor.js:371:26)
at e:\js_project\decipher-excel\node_modules\xlsx-populate\lib\Encryptor.js:247:30
[Done] exited with code=0 in 0.285 seconds
and this is my code: `const XlsxPopulate = require("xlsx-populate");
var pa=String.raw
E:\js_project\decipher-excel\excel\TEST Passwrod[a-1].xlsx
;async function openExcel(file, password) { try { await XlsxPopulate.fromFileAsync(file, { password }); console.log("ok"); return true; } catch (error) { console.error(error); return false; } }
openExcel(pa,'1');`
can somebody tell me why?(i will be cry)