Loop while excel sheets


#1

Hi all, I created a dyn file which allow to import coordinates from an excel file and draw curves inside the model. As I have different sheets, I’d like to create a unique code with a loop while that cycle different sheets inside the excel file. I’m trying with attached soluzion, but doesn’t work correctly. It takes sheet number 2 only, while I’d like to cycle the entire code for each sheet (1,2,3,4,5, ect…). Could anyone help me? Thanks in advance. Regards


#2

you’re getting there, but you have to put your code that loops as a function inside the loop body. for example, you could wrap up the excel.readFromFile inside a custom node and leave one input free(the sheet name) then this input would be incremented and passed into the loopBody Function … your code in on the wrong side of the while loop :slight_smile:

 

BUT… this problem can be solved by just putting a list of {1,2} or 1…2(range syntax) into the sheet name port, the node will replicate over that list and return both results.

 

I don’t think you need to use loop.while at all.