Invalid Address format: (tablename)[(tablefield)] Exception

May 6, 2013 at 6:11 PM
Edited May 6, 2013 at 6:11 PM
Just an FYI for those using EPPlus for reading data formatted in a table. I created a file with a tab with two tables that referenced each other via Vlookups and DataValidation dropdown lists. Anyways, when trying to set the worksheet to a variable, I was getting an exception:

Invalid Address format: mytablename[mytablefield]

No matter how many different names I tried, I still got this exception. Finally, I decided to remove the table format, and then recreate the table, using the same tablename and field names which fixed the issue.

I have no clue why this exception was occurring but I just wanted to post this in case someone else runs into this problem in the future.
Aug 29, 2013 at 9:03 PM
I have the same problem. I have a workbook with multiple worksheets, each sheet having a single table in it. I get the same exception to occur on the line:

worksheet = package.Workbook.Worksheets["Contacts"];

package.Workbook is a valid workbook and "Contacts" is the name of the worksheet I want to access. (Using an array index produces the same error).

If I manually remove the table formatting from the table and then run this code again, I no longer receive the exception. There is an issue raised for it here but it is set to low priority. I think it should be raised to high priority as until it is fixed it is impossible to work with Excel files which contain tables.