# How to make InputTable

There is InputField in mma but how to make InputTable? In MathCAD its possible to insert Excel spreadsheet with input and output variables.Input variables I use for filling of header row and column and output variable for output. How to make the same functionality in mma? Thanks in advance

-
Thanks for the accept, but there's no need for speed. It's better to give it a few hours or even days, so that more answers come in. – Sjoerd C. de Vries Sep 16 '12 at 15:15
This MathCAD feature is very good but nothing like it exists built in to Mma. The closest is TableView which @SjoerdC.deVries has shown below. It is undocumented and falls way short of the MathCAD implementation. Fingers crossed for a full documented and better version for V9. – Mike Honeychurch Sep 16 '12 at 22:46

## 1 Answer

nrows = 3; ncols = 4;
t = ConstantArray[0, {nrows, ncols}];
it = Table[With[{i = i, j = j}, InputField[Dynamic[t[[i, j]]]]], {i,nrows}, {j, ncols}];

Dynamic[TableView[it]]


Another dynamic view to show it works:

Transpose[t] // TableView // Dynamic


(the Transpose here just used to show it actively uses the input).

Please note that I used the undocumented TableView to make it more Excel-like, but I noticed that cell selection is a bit sluggish and/or unpredictable. You may want to change to Grid instead, which seems to work better.

-
@NasserM.Abbasi As you can see in the figures it is quite possible to enter data in all the rows (I work on the same platform as you), but there is a good reason for my advice to use Grid. – Sjoerd C. de Vries Sep 16 '12 at 15:12
Dangerous to rely upon undocumented (even unreliable) TableView. It would be really convenient if TableView were implemented reliably and with documentation in a future Mathematica version, but that's something we cannot count on, of course. So Grid is probably better to use for now. – murray Sep 16 '12 at 15:23
But inputed values dissapear after recalculation of notebook?! – SergeyFomin Sep 16 '12 at 16:27
@SergeyFomin Did you notice the line: t = ConstantArray[0, {nrows, ncols}]; in the code? What do you think it does? – Sjoerd C. de Vries Sep 16 '12 at 18:30
It initialize the array t of course.But I need to keep inputed values.I guess its obvious thing or no? – SergeyFomin Sep 16 '12 at 19:34