Import elements/properties from XLSX-file

Started by Franky, August 31, 2023, 07:19:39 AM

Previous topic - Next topic


Hello everyone,

I am looking for a good (simple) example of a script that allows to read the contents of an XLSX file. The intention is to update the repository and diagrams based on that content.

Thanks in advance for your thoughts.

Important extra info: I am using GraalVM as the JavaScript Engine within JArchi.

Kind regards


Jean-Baptiste Sarrodie


You can have a look at this discussion which also provides a piece of code:

Note that this is almost two years old, so it would make sense to also test with the latest version of SheetJS (just in case it now works out of the box).


If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.


Thanks for the quick response Jean-Baptiste.

I will test it out and share the result with you via this way.




Thanks Jean-Baptiste!

I updated the code you referred to. I'm now using SheetJS (version 0.20.0), the 'full' variant.

SheetJS is available at this link:

I have tested the code and found it working both in Nashorn ES6 and GraalVM (JavaScript Engine).

Below you can see the used code:


// SheetJS doesn't work with Nashorn in ES5 mode
// download link:
// SheetJS v0.20.0 are known to work with Nashorn in ES6 mode and with GraalVM
load(__DIR__ + 'lib\\SheetJS\\v0.20.0\\xlsx.full.min.js');

let filePath = __DIR__ + 'Test.xlsx';
let workbook =, { type: 'base64'});

// Dump file content in JSON
workbook.SheetNames.forEach(function(sheetName) {
  var XL_row_object = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]);
  var json_object = JSON.stringify(XL_row_object);

// ============================================================================

function readFileSync(path) {
  let Files = Java.type("java.nio.file.Files");
  let Paths = Java.type("java.nio.file.Paths");
  return Files.readAllBytes(Paths.get(path));

function base64encode(byteArray) {
  let Base64 = Java.type("java.util.Base64");
  return Base64.getEncoder().encodeToString(byteArray);

Kind regards