Handle two or more LibreOffice Calc sheets with loadTable() statement

Hi, i’m looking for a way to handle a file .ods which contains more sheets. In the loadTable() documentation i don’t find how to do… my intent is something like:

table = loadTable("example");
s = table.sheet("sheet2");

… maybe i’m on the wrong way?

regards!
Dennis

@Dennis – I think that loadTable() works with plain text formats like CSV and TSV. So what you would do is export the ODS worksheets to separate csv files – sheet1.csv, sheet2.csv, sheet3.csv – and then import each with loadTable.

If you want a combined object to access them, then you can create a Table[] sheets array object and load your sheets with loadTable into sheets[0], sheets[1], sheets[2]… now you can access it like this:

Table[] sheets = new Table[3];
sheets[2] = loadTable("sheet2.csv");

s = sheets[2];
s.getRow(10).getInt(2);

or

sheets[2].getRow(10).getInt(2);
1 Like

Thank you, I try it !!!:+1: