AX2012 Loop Excel sheets

Hello guys,

I’m trying to read data from excel with 20 sheets. To do this I’ve written a “for” loop that call this code:
worksheet = worksheets.itemfromnum(sheet)

where sheet is my index for the loop.

For the first loop i can read from the excel, but at the second loop the itemfromnum function return me a null object.

Thanks a lot.

You should provide more code for someone to be able to help