Q:

Select the fill rows and fill columns (rows and columns with values) from excel file

It's a simple question but I didn't succeed to do it.
I need to run with a loop on the rows and columns with the value - to select the values.
I write a function to do it but with the debug I see that the rows count number is 1048576 and the file has just 32 rows with values (the same happens with the columns)
The function code:
let functionParseXmlToCsv (xmlFile:string , excelFormatFile:string , excelPath:string) =

    let xlApp = new Excel.ApplicationClass()
    let xlWorkBookInput = xlApp.Workbooks.Open(excelPath  + DateTime.Today.ToString("yyyy_dd_MM")+".xlsx")
    let listOfRows = ResizeArray<string>()

    for tabs in 1 .. xlWorkBookInput.Worksheets.Count do

        let listOfCells = ResizeArray<string>()

        let xlWorkSheetInput = xlWorkBookInput.Worksheets.[tabs] :?> Excel.Worksheet

        let filePath =  excelPath + DateTime.Today.ToString("yyyy_dd_MM")+"_"+xlWorkSheetInput.Name+".csv"

        //let csvFile = File.Create(filePath)

        use csvFile = StreamWriter(filePath, true)

        for rowNumber in 1 .. xlWorkSheetInput.Rows.Count do

            for columnNumber in 1.. xlWorkSheetInput.Columns.Count do

                let cell = xlWorkSheetInput.Cells.[rowNumber,columnNumber]

                let value = string cell

                listOfCells.Add(value)

            let s = String.Join(", ", listOfCells)

            csvFile.WriteLine(s)

    File.Exists(excelPath  + DateTime.Today.ToString("yyyy_dd_MM")+".xlsx")

Could someone help me?

A:

Try if UsedRange fixes your issue. So change your row / column loop to
for rowNumber in 1 .. xlWorkSheetInput.UsedRange.Rows.Count do

and 
for columnNumber in 1.. xlWorkSheetInput.UsedRange.Columns.Count do

