Published
Edited
Oct 19, 2021
Fork of Hyperformula
5 stars
Insert cell
Insert cell
Insert cell
table(data, {
colHeaders: true,
rowHeaders: true,
formulas: {
engine: hf,
sheetName: "Sheet1"
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
runFormula = (formula) => {
// // Using a separate sheet
// if (hf.countSheets() < 2) {
// hf.addSheet('Queries');
// }
// hf.setCellContents({ sheet: 1, col: 0, row: 0 }, [[formula]]);
// return hf.getCellValue({ sheet: 1, col: 0, row: 0 });
// // Using named expression
// if (hf.listNamedExpressions().includes('Query')) {
// hf.changeNamedExpression('Query', formula);
// } else {
// hf.addNamedExpression('Query', formula);
// }
// return hf.getNamedExpressionValue('Query');
return hf.calculateFormula(formula, 0);
}
Insert cell
FormulaEditor = async (doc = '', extensions = []) => {
// https://github.com/codemirror/legacy-modes
// const { StreamLanguage } = await skypack('@codemirror/stream-parser');
// const { mathematica } = await skypack(
// '@codemirror/legacy-modes/mode/mathematica'
// );
return CodeMirror(doc, [
// StreamLanguage.define(mathematica),
...extensions
]);
}
Insert cell
Insert cell
data = {
const response = await fetch(
"//raw.githubusercontent.com/vega/vega/master/docs/data/cars.json"
);
return response.json();
}
Insert cell
// hf = {
// const hf = HyperFormula.buildFromArray(
// viewof dataTable.hot.getSourceDataArray(),
// {
// precisionRounding: 4,
// licenseKey: 'gpl-v3'
// }
// );
// Object.keys(data[0]).forEach((column, index) => {
// const a1 = hf
// .simpleCellAddressToString({ sheet: 0, col: index, row: 0 })
// .replace(/Sheet1!([A-Z])\d/, '$1');
// hf.addNamedExpression(column, `${a1}:${a1}`);
// });
// return hf;
// }
// hf = HyperFormula.buildFromArray(viewof dataTable.hot.getSourceDataArray(), {
// precisionRounding: 4,
// licenseKey: "gpl-v3"
// })
hf = HyperFormula.buildEmpty()
Insert cell
import { table } from "@gnestor/table"
Insert cell
import { CodeMirror, skypack } from '@gnestor/codemirror'
Insert cell
import { HyperFormula } from "@gnestor/hyperformula"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more