B
B
bergezer2021-08-30 14:46:13
excel
bergezer, 2021-08-30 14:46:13

How to read excel file from response.body?

There is an EndPoint that should return an xlsx file in response.body.
console.log(response.body)
Outputs something like


ZS[Content_Types].xml���n�0E%�J
]TUE`�DzE*�מ
��(�}'�T�V�3w�YM��+�hc�Ű���Ɔy-> f/�(�T0������x4�$��{֢%JR�n�+�b���&f����y.��
...


const buff = await Buffer.from(response.body);
console.log(buff);


BUFFER 50 4B 03 04 14 00 08 08 00 0d 5b 1e 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5b 43 6F 65 65 6e 74 54 79 79 70 65 5D 2E 78 6D 6D 6D 6C ef...


I'm trying to read a file with the convert-excel-to-json library,

Error: End of data reached (data length = 5979, asked index = 204079104). Corrupted zip?


Moreover, if you read the xlsx file downloaded via swagger, it is perfectly readable by the convert-excel-to-json library. I also noticed that the size of the file sent from the server is larger than it comes in response.body.
Tell me which library is more correct to read such files, or maybe the problem is something else?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question