Finding first row with data in the excel sheet RRS feed

  • Question

  • User1273726345 posted

     I am trying to parse through an excel sheet and fill in the data from it into a data set and then work with the extracted data. Presently im targeting the coordinates that the data is filled in to in the excel sheet and then extracting the data by code. For eg. if cells A1 - G14, I target them and upload the data in to the data set.

    How can i set it to where it can check to find the first row with data on the spreadsheet to the last row with data and then extract that? Eg, if there is no data from A1 to A4 and the header starts at A5. How can i set it to automatically detect that the data starts at A5 without having to specifically mention in code that it starts from there.

    Suggestions? Comments?

    Monday, November 9, 2009 11:59 AM

All replies

  • User-837620913 posted

    Have you tried Select * From [WorksheetName$] ?  That should return all data in the Excel for the given worksheet.

    You can select that data into a dataset so you can work with it however you want:


    Monday, November 9, 2009 1:59 PM
  • User1273726345 posted

     Yes i have, but say I want to push into the datatable only data from Rows A 10 to whatever is the last row number that contains data. How do I do that?

    The last row that will contain data varies from spreadsheet to spreadsheet, so how can i make it dynamic to where it has a fixed starting row, but finds out the last row that has data, and use it as the last row that has data?

    Tuesday, November 10, 2009 2:53 PM