cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Parser not producing empty document view

MikeP
New Contributor II

Hello Community, I have a problem where my excel parser snap is not producing an output document view when I’m parsing a file with only headers present and no actual data (this is a valid business scenario we have to deal with). I have the same pipeline logic when dealing with CSV parser (with empty data and only headers file), and I at least get an empty document view to check against (using an expression like $.isEmpty()).

Is this a bug in the Excel Parser snap? In the views tab on the excel parser I have output min of 1, so I should get a document output to check against (like the csv parser does), empty or not.

There is nothing of any help in the documentation for this Excel Parser snap I can see to help me, so any help or workarounds to this would be appreciated.

Thanks
Mike

2 REPLIES 2

ddellsperger
Moderator
Moderator

Hi there, I just tried to re-create this scenario, when both Excel files and CSV Files have only the header defined, I see both output nothing in their output (see validation screenshot below).
It’s important to recognize that the output minimum is for the number of output views, not the number of documents being output. This is with the defaults for both (other than the Excel Parser checking the Contains Header option). It seems you may have unchecked the “Ignore Empty Data” option in the csv parser, that is what will produce this output. The difference is that with Excel, if we don’t have any data visible after the first row, we won’t even potentially have data to push.

image

One possible way to address this, specifically with the Excel Parser is to do a precursory check via the excel parser with Contains Headers unchecked and then use a gate to count the output documents followed by a router based on the count with the count being zero, you can use a JSON Generator set t [{}] to generate the empty document and have the other go through and re-read the file and re-parse it with headers when the count is greater than one. I’d say it’s unlikely that there would be added support to push out an empty document at least in the near future, but this configuration might get you through in the interim (I’m attaching an SLP plus the csv and excel files that I’ve used to achieve this)

test_excel_some_data.xlsx (8.4 KB)
test_excel_some_data.csv (59 Bytes)
test_excel_no_data_but_headers.xlsx (8.4 KB)
test_excel_no_data_but_headers.csv (32 Bytes)
Excel Parser No Output When Just Headers_2022_10_11.slp (15.0 KB)

MikeP
New Contributor II

Many thanks for this, I will try the solution suggested. Appreciate your effort on this. Thanks Mike