spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
Logging sheet to console for easier inspection
author
Ben Vogt <[email protected]>
date
2016-12-27 03:35:28
stats
3 file(s) changed, 7 insertions(+), 131 deletions(-)
files
ts.html
ts/sheet.js
ts/sheet.ts
  1diff --git a/ts.html b/ts.html
  2index 5961183..d8b18ab 100644
  3--- a/ts.html
  4+++ b/ts.html
  5@@ -18,138 +18,9 @@
  6 
  7   <script src="ts/parser.js"></script>
  8   <script src="ts/sheet.js"></script>
  9-  <style>
 10-    .table input[type=text] {
 11-      width: 50px;
 12-    }
 13-    #suportedList ul {
 14-      -webkit-column-count: 4; -webkit-column-gap:20px;
 15-      -moz-column-count:4; -moz-column-gap:20px;
 16-      -o-column-count:4; -o-column-gap:20px;
 17-      column-count:4; column-gap:20px;
 18-    }
 19-  </style>
 20 </head>
 21 <body>
 22-<div class="col-xs-12">
 23-  <section>
 24-    <h1 class="page-header">RuleJS</h1>
 25-    <section>
 26-      <h1 class="page-header">Demo</h1>
 27-      <p>Try to parse the formula by typing ex. <code>AND(1,0)</code> into input below and press <kbd>Parse</kbd> button.</p>
 28-
 29-      <div class="col-xs-12" style="padding: 0px;" id="mine">
 30-
 31-        <input type="text" id="X1" placeholder="ex. AND(1,0)"><button>Parse</button>
 32-
 33-        <p class="bg-info" style="display: none">result: <span id="result"></span></p>
 34-        <p class="bg-danger" style="display: none">error: <span id="error"></span></p>
 35-        <p class="clearfix"></p>
 36-
 37-        <p>Try to insert formula into input field by typing ex. <code>=A1</code>. It's possible to edit formula by double clicked on input field.</p>
 38-        <table class="table table-bordered">
 39-          <thead>
 40-          <tr>
 41-            <td></td>
 42-            <td>A</td>
 43-            <td>B</td>
 44-            <td>C</td>
 45-            <td>D</td>
 46-            <td>E</td>
 47-            <td>F</td>
 48-            <td>G</td>
 49-            <td>H</td>
 50-            <td>I</td>
 51-            <td>J</td>
 52-            <td colspan="2" class="text-center">fn(x)</td>
 53-          </tr>
 54-          </thead>
 55-          <tbody>
 56-          <tr>
 57-            <td>1</td>
 58-            <td><input type="text" id="A1" value="1"></td>
 59-            <td><input type="text" id="B1" value="2"></td>
 60-            <td><input type="text" id="C1" value="3"></td>
 61-            <td><input type="text" id="D1" value="4"></td>
 62-            <td><input type="text" id="E1" value="5"></td>
 63-            <td><input type="text" id="F1" value="6"></td>
 64-            <td><input type="text" id="G1" value="7"></td>
 65-            <td><input type="text" id="H1" value="8"></td>
 66-            <td><input type="text" id="I1" value="9"></td>
 67-            <td><input type="text" id="J1" value="10"></td>
 68-            <td>SUM(A1:D1, H1)</td>
 69-            <td><span id="K1" data-formula="SUM(A1:D1, H1)"></span></td>
 70-          </tr>
 71-          <tr>
 72-            <td>2</td>
 73-            <td><input type="text" id="A2" value="-1"></td>
 74-            <td><input type="text" id="B2" value="-10"></td>
 75-            <td><input type="text" id="C2" value="2"></td>
 76-            <td><input type="text" id="D2" value="4"></td>
 77-            <td><input type="text" id="E2" value="100"></td>
 78-            <td><input type="text" id="F2" value="1"></td>
 79-            <td><input type="text" id="G2" value="50"></td>
 80-            <td><input type="text" id="H2" value="20"></td>
 81-            <td><input type="text" id="I2" value="200"></td>
 82-            <td><input type="text" id="J2" value="-100"></td>
 83-            <td>MAX(A2:J2)</td>
 84-            <td><span id="K2" data-formula="MAX(A2:J2)"></span></td>
 85-          </tr>
 86-          <tr>
 87-            <td>3</td>
 88-            <td><input type="text" id="A3" value="-1"></td>
 89-            <td><input type="text" id="B3" value="-40"></td>
 90-            <td><input type="text" id="C3" value="-53"></td>
 91-            <td><input type="text" id="D3" value="1"></td>
 92-            <td><input type="text" id="E3" value="10"></td>
 93-            <td><input type="text" id="F3" value="30"></td>
 94-            <td><input type="text" id="G3" value="10"></td>
 95-            <td><input type="text" id="H3" value="301"></td>
 96-            <td><input type="text" id="I3" value="-1"></td>
 97-            <td><input type="text" id="J3" value="-20"></td>
 98-            <td>MIN(A3:J3)</td>
 99-            <td><span id="K3" data-formula="MIN(A3:J3)"></span></td>
100-          </tr>
101-          <tr>
102-            <td>4</td>
103-            <td><input type="text" id="A4" value="20"></td>
104-            <td><input type="text" id="B4" value="50"></td>
105-            <td><input type="text" id="C4" value="100"></td>
106-            <td><input type="text" id="D4" value="20"></td>
107-            <td><input type="text" id="E4" value="1"></td>
108-            <td><input type="text" id="F4" value="5"></td>
109-            <td><input type="text" id="G4" value="15"></td>
110-            <td><input type="text" id="H4" value="25"></td>
111-            <td><input type="text" id="I4" value="45"></td>
112-            <td><input type="text" id="J4" value="23"></td>
113-            <td>AVERAGE(A4:J4):</td>
114-            <td><span id="K4" data-formula="AVERAGE(A4:J4)"></span></td>
115-          </tr>
116-          <tr>
117-            <td>5</td>
118-            <td><input type="text" id="A5" value="0"></td>
119-            <td><input type="text" id="B5" value="10"></td>
120-            <td><input type="text" id="C5" value="1"></td>
121-            <td><input type="text" id="D5" value="10"></td>
122-            <td><input type="text" id="E5" value="2"></td>
123-            <td><input type="text" id="F5" value="10"></td>
124-            <td><input type="text" id="G5" value="3"></td>
125-            <td><input type="text" id="H5" value="10"></td>
126-            <td><input type="text" id="I5" value="4"></td>
127-            <td><input type="text" id="J5" value="10"></td>
128-            <td>SUMIF(A5:J5,'>5')</td>
129-            <td><span id="K5" data-formula="SUMIF(A5:J5,'>5')"></span></td>
130-          </tr>
131-          </tbody>
132-        </table>
133-      </div>
134-
135-
136-
137-    </section>
138-  </section>
139-</div>
140-
141+look at the console.
142 <script>
143   var m = new mine('mine');
144   m.init();
145diff --git a/ts/sheet.js b/ts/sheet.js
146index 621e0fa..1cd00cf 100644
147--- a/ts/sheet.js
148+++ b/ts/sheet.js
149@@ -219,7 +219,9 @@ var mine = (function () {
150                     recalculateCellDependencies(trueCell);
151                 }
152             }
153-            console.log(this.data);
154+            this.data.forEach(function (item) {
155+                console.log(item.id, item.formula, item.value);
156+            });
157         };
158     };
159     var utils = {
160diff --git a/ts/sheet.ts b/ts/sheet.ts
161index ea73c1a..05b4740 100644
162--- a/ts/sheet.ts
163+++ b/ts/sheet.ts
164@@ -301,7 +301,9 @@ var mine = (function () {
165           recalculateCellDependencies(trueCell);
166         }
167       }
168-      console.log(this.data);
169+      this.data.forEach(function (item) {
170+        console.log(item.id, item.formula, item.value);
171+      })
172     };
173   };
174