Select to view content in your preferred language

Can you add a field to a table view?

1370
5
10-09-2012 02:27 AM
KarlWilson
Frequent Contributor
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
Frequent Contributor
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
Frequent Contributor
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
Frequent Contributor
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
Frequent Contributor
ah yeah.. excel... that beast we love to hate..
0 Kudos
JamesCrandall
MVP Alum
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