How to detect the used range of the cells?

hi, we want to extract the data from the uploaded excel file, so it is necessary to get the used range to iterate the cells.Is there some way to get the used range of the cells just like the Ms excel automation?

thanks.