I've posted this question before without success.
I have some lines making one user menu getting data from exceljs.
1 - How to put while condition inside this function, to get all rows to menu? Looks like switch(input) doesn't accept loop.
The logic is: * Read costumers.xlsx to get all costumers. * Loop all costumers as menu choices. * After the choice it'll open another xlsx file with the name of chosen costumer ie: 1 - Costumer1 2 - Costumer2 If I chose 1 I'll open costumer1.xlsx
2 - How to take that choice and pass as string to open the xlsx?
wb_costumers.xlsx.readFile('costumers.xlsx').then(function(){
sh_costumers = wb_costumers.getWorksheet("Sheet1");
var ic = 2;
while (ic <= sh_costumers.rowCount){
console.log("Row " + sh_costumers.getRow(ic).getCell(1) + " - " + sh_costumers.getRow(ic).getCell(2));
ic++;
}
});
function processChoice(input){
return new Promise(function(resolve, reject) {
var error = undefined;
var func;
switch(input){
case sh_costumers.getRow(2).getCell(1).text :
func = addPreset;
break;