I needed a simple no-frills spreadsheet-like page for a client project.
So I built the following and decided to publish it so that others can use it as they want.
You must open it in Coda to see it properly.
Each ‘cell’ is a formula, labeled A 1 thru I 20 (sorry but coda puts a space between the letter and the number).
Thus, when you click on a cell, you edit the formula. Move up one line to the 0 and replace it.
You then replace it with a number or an entire formula. The formula can refer to other Tables & Columns in the same doc.
In the formula you refer to other cells using the A 1 … I 20 labels.
I could only fit 9 columns across with a 9-digit result. But you can change that.
The formula N at the bottom of the page defines the width of all the cells.
And you can add more rows if you need them by copy/pasting the last row.
Each cell uses the LeftPad() and the Left() functions to keep a constant cell width for all results.
you can get rid of those spaces.
just click on EVERY cell and then click on the label, and then edit out the space.
for ALL 9*20 calls ie; 180 of them!
i made the fist formula and called it A
i then copy/pasted it across the first row
then i relabeled the 8 new formulas B through I (one by one)
then i copy/pasted the whole row 19 times
that gave me formulas called “A 2” to “I 20” (coda puts in the space when you copy a formula
i then renamed the top row of formulas to “A 1” thru “I 1” to maintain a consistent numbering
some day when i have some time to kill, i might go through all 180 cells and remove the spaces.
maybe somebody can think of a way to do it programmatically?
anyway - thats why there are spaces in the labels for now
And then, go to Embed and check if Enable Play is toggled On .
This will allow others to literally play with your doc but their actions won’t be saved .
I know I can — I was wondering why you had the spaces in the first place
(also had to add something to my comment so that it was 20 characters long, lol)
I’m actually thinking of a different way to implement this — with a table grouped in top and left, and a button that would recalculate everything, including entered formulas. The challenge then would be figuring out the dependency graph, i.e. in which order to recalculate formulas so that the sheet balances itself. Could be good content for Patreon though (which I recently reformed, by the way — hint hint )
As I said earlier, the spaces are put there by Coda when I copy and paste the rows of formulas.
It adds a space and a number to the end of a label if it already exists. So I am stuck with ‘D 12’ type labels.
I looked at your document that inserts an equation into an action using _Merge() & _Deref_Object().
I was hoping to be able to use that to convert text into formulas. But it wont work with references (by name) to columns or named canvas formulas, alas.
For now, it does what the client needs it to do. In fact they actually need way fewer cells, so I am making it smaller.
in order to improve performance of MicroSHEET, i need to know if there is a significant difference between ModifyRows() and SetControlValue.
im hoping to find that SetControlValue() is much faster because it does not involve a round-trip to the Coda servers, whereas ModifyRows() probably does (even if its using thisRow) ???
i seem to recall @Paul_Danyliuk mentioning something about this in a previous post, but cant find it.
It should make no difference really. Table cells will be easier to reference. In both cases (be it a cell edit or a control edit) the value is updated on the client immediately, and then gets sent to the server. The round trip I was talking about concerned the Row ID that got assigned on the server and only then displayed to the user after the row had been saved to the snapshot.
Each control is technically a table anyway. So yeah, no difference in terms of perf, theoretically.
i tested the relative performance of the two methods of updating objects in Coda.
the C.SetControlValue(C+1) and the myTable.ModifyRows(N,N+1) formulas
by running a loop using each one for 2000 iterations.
the ModifyRows() function runs about 20% faster. this may be due to the fact that the control object C is a text string, so each update involves converting the expression result into a string.