Github user jvwing commented on the issue:

    https://github.com/apache/nifi/pull/929
  
    @jdye64 I'm still confused by the disparity between the annotation docs and 
the behavior of the processor, especially with respect to multiple sheets in 
the incoming spreadsheet.  From the annotations:
    
    > Each sheet from the incoming Excel document will generate a new Flowfile 
that will be output from this processor
    
    This was not my experience, and I believe the single call to 
`session.clone` on line 143, not performed in a loop, guarantees only a single 
flowfile to the success relationship.
    
    > @WritesAttribute(attribute="sheetname", description="The name of the 
Excel sheet that this particular row of data came from in the Excel document")
    
    But it has always been `UNKNOWN` for my tests.
    
    ---
    I created a unit test to help clarify how this is supposed to work.  From 
the docs, I believe the test below should pass, although it currently fails.  
Am I misunderstanding?
    
    Also see 
[branch](https://github.com/jvwing/nifi/tree/NIFI-2613-poi-excel-3-tests)
    [TwoSheets.xlsx](https://github.com/apache/nifi/files/778759/TwoSheets.xlsx)
    
        @Test
        public void testMultipleSheetsGeneratesMultipleFlowFiles() throws 
Exception {
    
            testRunner.enqueue(new 
File("src/test/resources/TwoSheets.xlsx").toPath());
            testRunner.run();
    
            testRunner.assertTransferCount(ConvertExcelToCSVProcessor.SUCCESS, 
2);
            testRunner.assertTransferCount(ConvertExcelToCSVProcessor.ORIGINAL, 
1);
            testRunner.assertTransferCount(ConvertExcelToCSVProcessor.FAILURE, 
0);
    
            MockFlowFile ffSheetA = 
testRunner.getFlowFilesForRelationship(ConvertExcelToCSVProcessor.SUCCESS).get(0);
            Long rowsSheetA = new 
Long(ffSheetA.getAttribute(ConvertExcelToCSVProcessor.ROW_NUM));
            assertTrue(rowsSheetA == 4l);
            
assertTrue(ffSheetA.getAttribute(ConvertExcelToCSVProcessor.SHEET_NAME).equalsIgnoreCase("TestSheetA"));
    
            MockFlowFile ffSheetB = 
testRunner.getFlowFilesForRelationship(ConvertExcelToCSVProcessor.SUCCESS).get(1);
            Long rowsSheetB = new 
Long(ffSheetB.getAttribute(ConvertExcelToCSVProcessor.ROW_NUM));
            assertTrue(rowsSheetB == 3l);
            
assertTrue(ffSheetB.getAttribute(ConvertExcelToCSVProcessor.SHEET_NAME).equalsIgnoreCase("TestSheetB"));
        }



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to