# Basic usage

TIP

The instance can be created with three static methods: buildFromArray, buildFromSheets or buildEmpty. You can check all of their descriptions in our API reference.

If you've already installed the library, it's time to start writing the first simple application.

First, if you used NPM or Yarn to install the package, make sure you have properly imported HyperFormula as shown below:

import { HyperFormula } from 'hyperformula';

If you embed HyperFormula in the <script> tag using CDN, then it will be accessible as global variable HyperFormula and ready to use.

Now you can use the available options to configure the instance of HyperFormula according to your needs, like this:

const options = {
    licenseKey: 'gpl-v3'
};

Then, prepare some data to be used by your app. In this case, the data set will contain numbers and just one formula =SUM(A1,B1). Use the buildFromArray method to create the instance:

// define the data
const data = [['10', '20', '3.14159265359', '=SUM(A1:C1)']];

// build an instance with defined options and data 
const hfInstance = HyperFormula.buildFromArray(data, options);

Alright, now it's time to do some calculations. Let's use the getCellValue method to retrieve the results of a formula included in the data .

// call getCellValue to get the calculation results
const mySum = hfInstance.getCellValue({ col: 3, row: 0, sheet: 0 });

You can check the output in the console:

// this outputs the result in the browser's console
console.log(mySum);

That's it! You've grasped a basic idea of how the HyperFormula engine works. It's time to move on to a more advanced example.

# Demo

result: