Can you add a field to a table view?

1045
5
10-09-2012 02:27 AM
KarlWilson
Occasional Contributor III
The documentation for the AddField_management tool implies that it will accept a Table View as an input data type. Whenever I try to add a field to a Table View however I get the message:
"ERROR 000499: table is not editable Failed to execute (AddField)."
Tags (2)
0 Kudos
5 Replies
ChristopherThompson
Occasional Contributor III
What is the source of the table? If its an SDE table maybe the connection string you are using doesn't allow for editing?
0 Kudos
KarlWilson
Occasional Contributor III
It's an excel spreadsheet.
I guess the table view is just that then, a view of the data. I had conceived it more as an "in-memory" copy, and therefore editable.
0 Kudos
MarcinGasior
Occasional Contributor III
You can't edit connected Excel spreadsheet, the same as it's not possible to edit XY Event Layer table of attributes.

But you can use Copy Rows to copy the spreadsheet content into in_memory workspace (Output table = in_memory\worksheet_table). Then you can add fields to this temporary table.
0 Kudos
ChristopherThompson
Occasional Contributor III
ah yeah.. excel... that beast we love to hate..
0 Kudos
JamesCrandall
MVP Frequent Contributor
You can edit an Excel spreadsheet, but it will have to be done with another Py lib that is capable of such a thing.  A quick search on Stackexchange turns up a lot of solutions, maybe have a look at http://pypi.python.org/pypi/xlrd

Just fyi: I have had a lot of success implementing additional libaries like this.  cx_Oracle python lib has been a great tool to integrate non-spatial data that is maintained in our Oracle database(s)!

Good luck!
0 Kudos