title: How do I set a new cell after the last existing column?
body: <p>I need to set a new column called <code>Status</code> after the last existing column, but my code is some columns before and using getLastColumn displays nothing.<br> How do I set a new cell <b>after the last column</b> ("Link especificação")?</p>
  
  <pre><code> private Workbook setStatus(Workbook wb, Map&lt;String, Integer&gt; header, List&lt;ValidacaoResultado&gt; validation, Planilha planilha) {
          Sheet sheet = wb.getSheetAt(0);
          CellStyle style;
          int coluna = header.size() + 1;
          List&lt;BasicDBObject&gt; lista = planilha.getSpec();
          Map&lt;Integer, String&gt; items = new HashMap&lt;&gt;();
          Map&lt;String, String&gt; itemsValidacao = new HashMap&lt;&gt;();
          for (BasicDBObject itemsNome : lista) {
              Map extras = (Map) itemsNome.get("extras");
              items.put(Integer.parseInt(extras.get("linha").toString()) - 1, itemsNome.get("peca_nome").toString());
          }
          try {
              for (ValidacaoResultado aValidation : validation) {
                  if (aValidation.getSpec() != null) {
                      if (aValidation.getArquivo() != null) {
                          String nomeOriginal = aValidation.getSpec().get("peca_nome").toString();
                          itemsValidacao.put(nomeOriginal, aValidation.getResultadoConsolidado());
                      } else {
                          String nomeOriginal = aValidation.getSpec().get("peca_nome").toString();
                          itemsValidacao.put(nomeOriginal, aValidation.getResultadoConsolidado());
                      }
                  }
              }
          } catch (Exception e) {
              Log.error(this, "erro");
          }
  
          for (Row row : sheet) {
              Iterator&lt;Cell&gt; cellIterator = row.cellIterator();
              while (cellIterator.hasNext()) {
                  Cell cell = cellIterator.next();
                  if (row.getRowNum() == LINHA_CABECALHO &amp;&amp; cell.getColumnIndex() == header.size()) {
                      style = cell.getCellStyle();
                      Cell status = row.createCell(coluna);
                      status.setCellValue("Status");
                      status.setCellStyle(style);
                  }
                  if (cell.getColumnIndex() == coluna &amp;&amp; row.getRowNum() &gt; LINHA_CABECALHO) {
                      String peca = items.get(row.getRowNum());
                      String status = itemsValidacao.get(peca);
                      if (status != null) {
                          if (status.toLowerCase().contains("spec") || status.toLowerCase().contains("media")) {
                              status = "Não contém mídia.";
                          }
                      }
                      cell.setCellValue(status);
                  }
              }
          }
          return wb;
      }
  </code></pre>
  
  <p>This is the result code<br>
  <img src="https://i.stack.imgur.com/3g5vT.png" alt="enter image description here"></p>
  
  <p>This is the result when I set the new cell as <code>row.getLastColumn + 1</code><br>
  <img src="https://i.stack.imgur.com/p0Fl1.png" alt="enter image description here"></p>