title: How do i create a multiple sheets in same workbook on base of dropdown selection using Apache POI?
body: <p>I have to select the option one after another from dropdown say (AAA,BBB... GGG) and after selection whatever the data populate have to be written on excel. Here method clickOnPerfomanceDetails() contains the code to write it down onto Excel. My following code is writing successfully onto excel with different sheets but manually i comment other options. In all 7 times i am executing the script to get data into 7 different worksheet. </p>
  
  <pre><code>public void clickOnPerformanceDetails() throws Exception {  
          File file = new File("C:\\Users\\dp\\Desktop\\Performance.xlsx");
          XSSFWorkbook wb = (XSSFWorkbook) WorkbookFactory.create(new FileInputStream(file));
           XSSFSheet sheet = wb.createSheet("AAA");
          //XSSFSheet sheet = wb.createSheet("BBB");
          //XSSFSheet sheet = wb.createSheet("CCC");
              // XSSFSheet sheet = wb.createSheet("DDD");
  
  
          //CODE
  
  FileOutputStream fos = new FileOutputStream("C:\\Users\\dp\\Desktop\\Performance.xlsx");
              wb.write(fos);
              fos.close();
  
  }
  
  @Test()
  public void providerTest1() throws Exception {
      performance_PlusTWO.hoverTest();
      performance_PlusTWO.clickOnHieararchyDropDown();
      performance_PlusTWO.selectOptionNais();
  
      //AAA
      performance_PlusTWO.selectAAAOption();
      performancePlus_TWO.clickOnPerformanceDetails();
  
      //BBB
      //performance_PlusTWO.selectBBBOption();
      //performanceP_TWO.clickOnPerformanceDetails();
  
      //CCC
      performance_PlusTWO.selectAAAOption();
      performance_TWO.clickOnPerformanceDets();
  }
  </code></pre>
  
  <p>Creating 'AAA' worksheet and running  Test for  <code>performance_PlusTWO.selectAAAOption();</code>
      <code>performancePlus_TWO.clickOnPerformanceDetails()</code>; Then manually i comment 'AAA' option, uncomment 'BBB' option and again execute the script. How do on a single click i execute the data for all  the options.
  Any help will be appreciated.</p>