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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more