title: Convert csv file to xlsx in android java [android 6]
body: <p>I am creating a csv file by taking data from SQLite table. I want to convert the csv file to xlsx format for it to be shared by bluetooth. I am limited to android 6.</p>
  <p>I have tried:</p>
  <ol>
  <li>Apache POI (Min SDK Android 8)</li>
  <li>GroupDocs (Heap Memory Runs out)</li>
  <li>Aspose</li>
  </ol>
  <p>The 3rd one seems to work without android 6 but it gives error.</p>
  <p>Here are the code snippets:</p>
  <p>Generate Excel:</p>
  <pre><code> genrateExcel.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              String file = Environment.getExternalStorageDirectory().getAbsolutePath() + &quot;/Download/&quot;;
  
              LoadOptions loadOptions = new LoadOptions(FileFormatType.CSV);
  
              Workbook workbook = null;
              try {
                  workbook = new Workbook(file + &quot;SensorData.csv&quot;, loadOptions);
              } catch (Exception e) {
                  e.printStackTrace();
              }
  
              try {
                  workbook.save(file + &quot;CSVtoExcel.xlsx&quot; , SaveFormat.XLSX);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  </code></pre>
  <p>My CSV file is generated and is being saved in the Downloads Folder and is visible to user.</p>
  <p><a href="https://i.stack.imgur.com/7htxo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7htxo.png" alt="Page Where we export to CSV and Convert to XLSX" /></a></p>
  <p>I am getting an error on the line:</p>
  <pre><code> workbook = new Workbook(file + &quot;SensorData.csv&quot;, loadOptions);
  </code></pre>
  <p>Here is the link to the logcat file:
  <a href="https://batbin.me/overvault" rel="nofollow noreferrer">Logcat Link</a></p>
  <p>It says some class is missing:</p>
  <pre><code>java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/SystemColor;
  </code></pre>
  <p>and this:</p>
  <pre><code>java.lang.ClassNotFoundException: Didn't find class &quot;java.awt.SystemColor&quot;
  </code></pre>
  <p>I have searched whole internet for the conversion and didn't find any suitable to my needs.My last option is using Aspose but it shows some errors which also cannot be found upon Googling. Thanks in advance to all the people who will be helping.</p>