none
Excel update via field position, not name. Also, no key field RRS feed

  • Question

  • Hi,

    I am trying to update rows in an Excel spread sheet.  I have two issues.

    1) The is no real unique key data.   I update the 3rd, 5th, and 8th row in the data table and what the updates written back. I can rewrite the entire sheet if it will let me update.

    2) We will need to make single value changes.  We have a lot of fields and our users change the names of the columns to suit their needs.  Therefore we always access the columns by position.  For example, table.item(4).  How can we write this change a single row.  That is, is there a way to reference the column position, not the name, in the SQL update statement.

    Thanks,

    Jerry

    Friday, August 15, 2008 4:38 PM

All replies

  • Hi,

    1) To acccess the row uniquely, you can include a ID.

    2) To access specific column you can use columnName as well. E.g

    table.Rows[0][

    "ColumnName"] // C# Code

    or based on position

    table.Rows[0][2] // C# Code - where 0 is the row and 2 is the column.

    Tuesday, March 31, 2009 9:34 PM