How to Extract Sheet Names from an Uploaded Excel File in Mendix?

0
Hi all, I have a query. I uploaded an Excel file using the file manager, and the file contains multiple sheets. I want to extract and retrieve a list of sheet names. How can I achieve this?
asked
1 answers
0

you will need to create a Java Action that can extract the sheet names from the uploaded Excel file. For this, you will use the Apache POI library to read the Excel file and retrieve the sheet names.

Dependencies:

  • Download the required Apache POI libraries
    • poi-x.x.x.jar (Core library)
    • poi-ooxml-x.x.x.jar (For .xlsx files)
    • poi-ooxml-schemas-x.x.x.jar
    • xmlbeans-x.x.x.jar
  • You can add these libraries to your Mendix project by placing them in the libs folder.

Once the Java action is ready, you can call it from a microflow to retrieve the sheet names after the file has been uploaded.

  • Upload the Excel file using the File Manager.
  • Get the FileDocument object that corresponds to the uploaded file.
  • Call the Java action to retrieve the sheet names.

After retrieving the list of sheet names, you can display them in the Mendix UI:

  • You can use a Data Grid to display the list of sheet names or show them in a popup or a list view.
  • Bind the list of sheet names to a UI element in your page or microflow.

 

answered