apache poi - How to obtain the name of an active Excel spreadsheet and pass it into Java? -


i working on java app need integrate excel.

when testing java app, can hard code excel workbook name , can need to.

but, intention have excel workbook open , run vb macro launches java code , populates fileinputstream name active workbook name, not hard code workbook name in.

what need either:

in java, somehow name , path of current active excel workbook text string , use in code in place of hard coded name, intention have run on various workbooks.

i unable find way of doing via apache poi.

there seems getsheetname method available?

or alternatively, can vb name of current workbook string, i'm unsure how pass string java use workbook name string variable.

that's sticking point, else in java code runs to.

any advice appreciated.

if mean want active worksheet, there getactivesheetindex() method in workbook class, might able combine getsheetname()

string worksheetname = workbook.getsheetname(workbook.getactivesheetindex()); 

unless want actual path workbook (xls) open in excel calling java program, you'd want pass in name of workbook file parameter java executable.

ex. in vb: application.activeworkbook.path active workbook path.

my vb bit rusty think it'll like:

call shell("java yourjavaprogram" & application.activeworkbook.path) 

and can refer user506069's answer getting arguments on java side.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -