Forum Discussion

jfpelletier's avatar
jfpelletier
Contributor
2 years ago

Saving Excel document from zip file gives unexpected results

Hello all,

I'm doing something really simple, but I'm stuck with a basic issue that I don't really understand the root cause.

I'm running the pipeline below, which simply downloads a zip file from a server (using HTTP Client), writes the zip on the sldb, then reads the content of the zip before writing the file(s) that are archived in the zip.

My issue is that the zip file that I download has only one Excel document in a subfolder. When I try to use an expression to rename the file and write it to the root of the sldb, my document is not an Excel, it is a JSON (with an Excel name).

In my "File Writer" snap I use this expression for the file name: $['content-location'].replace(/\//, '-')

This is the value of $['content-location'] before the expression: 

"content-location" : "sk_SK/Captions - Document 4120202-1-6.xlsx"
 
This is the JSON that I get instead of the Excel:
{
"content-location":"sk_SK/Captions - Document 4120202-1-6.xlsx",
"content-type":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"content-length":3453,
"last-modified":"2024-03-25T18:15:24.000Z",
"zip-filename":"520277541.zip",
-- etc.. --
}
 
Now, if I set a fixed name for the Excel in the File Writer (for example, "myExcel.xlsx") then I get the expected Excel document, it is correctly saved.
 
I must be doing something wrong when I use the expression in the File Writer snap, I just can't figure out why I cannot write the documents from the zip file directly in the root of the sldb...
 
Anyone have a clue at what I am doing wrong?
 
Thanks all in advance,
 
JF
No RepliesBe the first to reply