Answer the question
In order to leave comments, you need to log in
What encoding to save excel data in?
Greetings!
There is a RestAPI that provides excel (xlsx) data as a request:
request.post(
rest_url+"/basecoefficient/getReport", { json: true, body: req.body.data, headers: {
'content-type' : "application/json; charset=utf-8", 'Authorization': "Bearer " + req.body.token } }
, function(err, response, body) {
console.log(response.body)
return res.json(response)
});
PK\u0003\u0004\u0014\u0000\b\b\b\u0000\u000b�DN\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u000b\u0000\u0000\u0000_rels/.rels���j�0\f�_���8�`�Q��2�m��\u00014[ILb��ږ���.[K\n\u001b�($}�\u0007�v?�I�Q.���uӂ�h���\u001bx>=��@\u0015��p�H\u00
Answer the question
In order to leave comments, you need to log in
Apparently, you process binary data as json.
I would reconsider in principle downloading the report - I would not return data, but would return a link where you can download the file.
In general terms, your POST request builds an excel and saves it to the file system. The output is a link to it, it is given to the client.
The client follows the link (the redirect is the same, for example), the file is downloaded and deleted from the server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question