### Initialize Jspreadsheet with Formula Pro Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/pv.md Examples showing the setup of Jspreadsheet and the Formula Pro extension in different frontend frameworks. ```html
``` ```jsx import React, { useRef } from "react"; import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/react"; import formula from "@jspreadsheet/formula-pro"; import "jsuites/dist/jsuites.css"; import "jspreadsheet/dist/jspreadsheet.css"; // Set license jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); export default function App() { // Spreadsheet array of worksheets const spreadsheet = useRef(); // Worksheet data const data = [ [ "Rate", "Periods", "Payment", "Future Value", "Present Value" ], [ 0.08, 10, -1000, 0, "=PV(A2/12,B2,C2,D2,0)" ], [ 0.06, 15, -500, 5000, "=PV(A3/12,B3,C3,D3,0)" ], [ 0.05, 20, -750, 10000, "=PV(A4/12,B4,C4,D4,0)" ] ]; // Render component return ( ); } ``` ```vue ``` ```angularjs import { Component, ViewChild, ElementRef } from "@angular/core"; import jspreadsheet from "jspreadsheet"; import * as formula from "@jspreadsheet/formula-pro"; // Set your JSS license key (The following key only works for one day) jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); @Component({ standalone: true, selector: "app-root", template: `
` }) export class AppComponent { @ViewChild("spreadsheet") spreadsheet: ElementRef; // Worksheets worksheets: jspreadsheet.worksheetInstance[]; // Create a new data grid ngAfterViewInit() { // Create spreadsheet this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, { worksheets: [{ data: [ [ "Rate", "Periods", "Payment", "Future Value", "Present Value" ], [ 0.08, 10, -1000, 0, "=PV(A2/12,B2,C2,D2,0)" ], [ 0.06, 15, -500, 5000, "=PV(A3/12,B3,C3,D3,0)" ], [ 0.05, 20, -750, 10000, "=PV(A4/12,B4,C4,D4,0)" ] ] }] }); } } ``` -------------------------------- ### REDUCE function usage examples Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/reduce.md Examples demonstrating how to apply a LAMBDA function to an array starting from an initial value. ```text REDUCE(0, [1, 2, 3, 4], MyLambdaFunction) returns the accumulated result of applying MyLambdaFunction to each element in the array. REDUCE(100, [10, 20, 30], AnotherLambda) returns the accumulated result of applying AnotherLambda to each element in the array starting from the initial value 100. REDUCE(1, [2, 3, 4], SomeOtherLambda) returns the accumulated result of applying SomeOtherLambda to each element in the array starting from the initial value 1. ``` -------------------------------- ### Initialize Jspreadsheet with Formula Extension Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/delta.md Examples showing the setup of Jspreadsheet and the formula-pro extension in different frontend frameworks. ```html
``` ```jsx import React, { useRef } from "react"; import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/react"; import formula from "@jspreadsheet/formula-pro"; import "jsuites/dist/jsuites.css"; import "jspreadsheet/dist/jspreadsheet.css"; // Set license jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); export default function App() { // Spreadsheet array of worksheets const spreadsheet = useRef(); // Worksheet data const data = [ [ "Expected", "Actual", "Match" ], [ 100, 100, "=DELTA(A2,B2)" ], [ 250, 245, "=DELTA(A3,B3)" ], [ 75, 75, "=DELTA(A4,B4)" ], [ 180, 185, "=DELTA(A5,B5)" ] ]; // Render component return ( ); } ``` ```vue ``` ```angularjs import { Component, ViewChild, ElementRef } from "@angular/core"; import jspreadsheet from "jspreadsheet"; import * as formula from "@jspreadsheet/formula-pro"; // Set your JSS license key (The following key only works for one day) jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); @Component({ standalone: true, selector: "app-root", template: `
` }) export class AppComponent { @ViewChild("spreadsheet") spreadsheet: ElementRef; // Worksheets worksheets: jspreadsheet.worksheetInstance[]; // Create a new data grid ngAfterViewInit() { // Create spreadsheet this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, { worksheets: [{ data: [ [ "Expected", "Actual", "Match" ], [ 100, 100, "=DELTA(A2,B2)" ], [ 250, 245, "=DELTA(A3,B3)" ], [ 75, 75, "=DELTA(A4,B4)" ], [ 180, 185, "=DELTA(A5,B5)" ] ] }] }); } } ``` -------------------------------- ### Initialize Formula Pro in Browser Source: https://github.com/jspreadsheet/pro/blob/master/docs/products/formulas.md Standalone setup for browser environments including license activation and precision adjustment. ```html ``` -------------------------------- ### Getting Started with Top Menu Plugin Source: https://github.com/jspreadsheet/pro/blob/master/docs/plugins/topmenu.md Guides on how to include and initialize the Top Menu plugin in your Jspreadsheet project, covering HTML setup, CDN, NPM, and basic initialization. ```APIDOC ## Get Started ### Header on page ```html // Initialize plugin on jSpreadsheet ``` ### CDN ```html ``` ### NPM ```bash npm install @jspreadsheet/topmenu ``` ```javascript import jss_topmenu from '@jspreadsheet/topmenu'; ``` ``` -------------------------------- ### GET /api/:guid - Get Spreadsheet Configuration Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/server/api/others.md Retrieves the configuration settings for a specified spreadsheet. ```APIDOC ## GET /api/:guid ### Description Get spreadsheet config. ### Method GET ### Endpoint /api/:guid ### Parameters #### Path Parameters - **guid** (string) - Required - The unique identifier of the spreadsheet. ### Request Example ```javascript import { Client } from "@intrasheets/client"; const client = new Client({ baseUrl: "http://localhost:8009/api", token: "YOUR_AUTH_TOKEN" }); const guid = '15eb1171-5a64-45bf-be96-f52b6125a045'; const spreadsheet = client.getSpreadsheet(guid); spreadsheet.getConfig().then((config) => { console.log(config); }); ``` #### Manual request ``` https://jspreadsheet.com/api/15eb1171-5a64-45bf-be96-f52b6125a045 ``` ### Response #### Success Response (200) - **config** (object) - The configuration object of the spreadsheet. ``` -------------------------------- ### LET function usage examples Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/let.md Examples demonstrating how to assign names to calculations and use them within formulas. ```text LET(x, A1 + B1) + LET(y, A2 + B2) returns the sum of the values in cells A1 through B2, with the intermediate results stored in the names x and y, respectively LET(area, PI() * radius ^ 2) returns the area of a circle with radius defined elsewhere in the worksheet LET(total_sales, SUM(A1:A10)) / LET(num_salespeople, COUNTA(B1:B10)) returns the average sales per salesperson for the range A1:A10, with the intermediate results stored in the names total_sales and num_salespeople, respectively. ``` -------------------------------- ### Installation Source: https://github.com/jspreadsheet/pro/blob/master/docs/products/topmenu.md Instructions for installing the Top Menu extension using NPM or a CDN. ```APIDOC ## Installation ### Using NPM ```bash $ npm install @jspreadsheet/topmenu ``` ### Using a CDN ```html ``` ``` -------------------------------- ### Install Client API Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/server/api.md Install the client-side API package. ```bash npm install @jspreadsheet/client-api ``` -------------------------------- ### Vue Topmenu Setup Source: https://github.com/jspreadsheet/pro/blob/master/docs/products/topmenu.md Implement the Topmenu extension in a Vue.js application using the Jspreadsheet Vue component. This example shows the template and script setup. ```vue
``` -------------------------------- ### Get Spreadsheet Guid Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/server/api/internal.md Retrieves the unique identifier for the spreadsheet instance using the Intrasheets client. ```javascript import { Client } from "@intrasheets/client"; // Create a new client const client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i", }); // Spreadsheet Guid const guid = '15eb1171-5a64-45bf-be96-f52b6125a045'; // Get the spreadsheet instance const spreadsheet = client.getSpreadsheet(guid); // Get spreadsheet guid console.log(spreadsheet.getSpreadsheetGuid()); ``` -------------------------------- ### Initialize Jspreadsheet with Formula Extension Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/price.md Examples showing how to set a license key, register the formula extension, and initialize a spreadsheet with data containing financial formulas. ```html
``` ```jsx import React, { useRef } from "react"; import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/react"; import formula from "@jspreadsheet/formula-pro"; import "jsuites/dist/jsuites.css"; import "jspreadsheet/dist/jspreadsheet.css"; // Set license jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); export default function App() { // Spreadsheet array of worksheets const spreadsheet = useRef(); // Worksheet data const data = [ [ "Settlement", "Maturity", "Rate", "Yield", "Redemption", "Price" ], [ "1/1/2024", "1/1/2034", 0.05, 0.06, 100, "=PRICE(A2,B2,C2,D2,E2)" ], [ "6/15/2024", "6/15/2029", 0.04, 0.045, 100, "=PRICE(A3,B3,C3,D3,E3)" ], [ "3/1/2024", "3/1/2044", 0.075, 0.08, 100, "=PRICE(A4,B4,C4,D4,E4)" ] ]; // Render component return ( ); } ``` ```vue ``` ```angularjs import { Component, ViewChild, ElementRef } from "@angular/core"; import jspreadsheet from "jspreadsheet"; import * as formula from "@jspreadsheet/formula-pro"; // Set your JSS license key (The following key only works for one day) jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); @Component({ standalone: true, selector: "app-root", template: `
` }) export class AppComponent { @ViewChild("spreadsheet") spreadsheet: ElementRef; // Worksheets worksheets: jspreadsheet.worksheetInstance[]; // Create a new data grid ngAfterViewInit() { // Create spreadsheet this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, { worksheets: [{ data: [ [ "Settlement", "Maturity", "Rate", "Yield", "Redemption", "Price" ], [ "1/1/2024", "1/1/2034", 0.05, 0.06, 100, "=PRICE(A2,B2,C2,D2,E2)" ], [ "6/15/2024", "6/15/2029", 0.04, 0.045, 100, "=PRICE(A3,B3,C3,D3,E3)" ], [ ``` -------------------------------- ### Angular Component Setup for jspreadsheet and Highcharts Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/examples/highcharts.md This Angular component demonstrates the setup for integrating jspreadsheet with Highcharts. It includes necessary imports and initial configuration for both libraries. Ensure Highcharts and jspreadsheet are installed and configured. ```typescript import { Component, ViewChild, ElementRef } from "@angular/core"; import Highcharts, { AlignValue, VerticalAlignValue } from 'highcharts' import jspreadsheet from "jspreadsheet"; import charts from "@jspreadsheet/charts"; jspreadsheet.setExtensions({ charts }); const chartOptions: Highcharts.Options = { title: { text: "Monthly Average Temperature", ``` -------------------------------- ### WEBSERVICE function usage examples Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/webservice.md Examples demonstrating how to fetch data from different URL sources using the WEBSERVICE function. ```text WEBSERVICE("https://api.example.com/data") returns:["key1": "value1", "key2": "value2"] WEBSERVICE("http://localhost:8080/data") returns:["key1": 123, "key2": "text"] WEBSERVICE("https://www.google.com/") returns:The HTML content of the Google homepage. ``` -------------------------------- ### Vue Jspreadsheet Setup Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/lambda.md Demonstrates Jspreadsheet and Formula Pro integration in a Vue.js application. Requires installation of '@jspreadsheet/vue'. ```vue ``` -------------------------------- ### Initialize Jspreadsheet Pro with Formulas Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/ttest.md Examples showing how to set up the Jspreadsheet Pro library and formula extension in different environments. ```html
``` ```jsx import React, { useRef } from "react"; import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/react"; import formula from "@jspreadsheet/formula-pro"; import "jsuites/dist/jsuites.css"; import "jspreadsheet/dist/jspreadsheet.css"; // Set license jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); export default function App() { // Spreadsheet array of worksheets const spreadsheet = useRef(); // Worksheet data const data = [ [ "Group A", "Group B", "T-Test Result" ], [ 85, 78, "=TTEST(A2:A6,B2:B6,2,2)" ], [ 92, 82, "" ], [ 88, 75, "" ], [ 91, 80, "" ], [ 87, 79, "" ] ]; // Render component return ( ); } ``` ```vue ``` ```angularjs import { Component, ViewChild, ElementRef } from "@angular/core"; import jspreadsheet from "jspreadsheet"; import * as formula from "@jspreadsheet/formula-pro"; // Set your JSS license key (The following key only works for one day) jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); @Component({ standalone: true, selector: "app-root", template: `
` }) export class AppComponent { @ViewChild("spreadsheet") spreadsheet: ElementRef; // Worksheets worksheets: jspreadsheet.worksheetInstance[]; // Create a new data grid ngAfterViewInit() { // Create spreadsheet this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, { worksheets: [{ data: [ [ "Group A", "Group B", "T-Test Result" ], [ 85, 78, "=TTEST(A2:A6,B2:B6,2,2)" ], [ 92, 82, "" ], [ 88, 75, "" ], [ 91, 80, "" ], [ 87, 79, "" ] ] }] }); } } ``` -------------------------------- ### GET /api/:guid/:worksheetIndex Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/server/api/config.md Retrieves the configuration object for a specific worksheet identified by its GUID and worksheet index. ```APIDOC ## GET /api/:guid/:worksheetIndex ### Description Get the worksheet configuration object. ### Method GET ### Endpoint /api/:guid/:worksheetIndex ### Parameters #### Path Parameters - **guid** (string) - Required - The unique identifier for the spreadsheet. - **worksheetIndex** (number) - Required - The index of the worksheet within the spreadsheet. ### Response #### Success Response (200) - **config** (object) - The configuration object of the worksheet. ### Response Example ```json { "config": { "filters": true, "columns": [ { "name": "Column A", "width": 100 } ] } } ``` ``` -------------------------------- ### Initialize OpenAI Extension in Frontend Source: https://github.com/jspreadsheet/pro/blob/master/docs/products/openai.md Demonstrates how to load the OpenAI extension and connect to a remote server in both vanilla HTML and React environments. ```html
``` ```jsx import React, { useRef } from "react"; import { Spreadsheet, Worksheet } from "@jspreadsheet/react"; import client from "@jspreadsheet/client"; import formula from "@jspreadsheet/formula-pro"; import openai from "@jspreadsheet/openai"; import "jsuites/dist/jsuites.css"; import "jspreadsheet/dist/jspreadsheet.css"; // Set the license jspreadsheet.setLicense('###license###'); // Define the extensions jspreadsheet.setExtensions({ formula, client, openai }); // Connect to your server let remote = client.connect({ url: 'https://yourdomain.com' }); export default function App() { // Spreadsheet array of worksheets const spreadsheet = useRef(); // Render component return (); } ``` -------------------------------- ### Clone and Run Jspreadsheet Server Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/server/nginx.md Clone the Jspreadsheet Server repository, install dependencies, and start the server using PM2. ```bash git clone https://github.com/jspreadsheet/server.git \ cd server\ npm install\ cd dist\ pm2 start index.js ``` -------------------------------- ### DGET function usage examples Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/dget.md Examples demonstrating how to retrieve specific values from a database range using various criteria conditions. ```text DGET(A1:C10,"Salary",[A1:A10,"John",C1:C10,">1000"]) returns the salary for John if their salary is greater than 1000 DGET(A1:C10,"Name",[A1:A10,"*doe*",B1:B10,">=3"]) returns the name of the first person whose last name contains "doe" and has been with the company for at least 3 years DGET(A1:E10,"Phone",[A1:A10,"Jane",B1:B10,"<>Sales",C1:C10,"<>Seattle"]) returns the phone number for Jane if they're not in Sales and not located in Seattle ``` -------------------------------- ### Initialize Jspreadsheet Pro with Formula Extension Source: https://github.com/jspreadsheet/pro/blob/master/docs/docs/formulas/functions/exp.md Examples demonstrating how to set a license key, register the formula extension, and initialize a spreadsheet with data containing mathematical formulas. ```html
``` ```jsx import React, { useRef } from "react"; import { Spreadsheet, Worksheet, jspreadsheet } from "@jspreadsheet/react"; import formula from "@jspreadsheet/formula-pro"; import "jsuites/dist/jsuites.css"; import "jspreadsheet/dist/jspreadsheet.css"; // Set license jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); export default function App() { // Spreadsheet array of worksheets const spreadsheet = useRef(); // Worksheet data const data = [ [ "Power", "e^x Result" ], [ 0, "=EXP(A2)" ], [ 1, "=EXP(A3)" ], [ 2, "=EXP(A4)" ], [ -1, "=EXP(A5)" ] ]; // Render component return ( ); } ``` ```vue ``` ```angularjs import { Component, ViewChild, ElementRef } from "@angular/core"; import jspreadsheet from "jspreadsheet"; import * as formula from "@jspreadsheet/formula-pro"; // Set your JSS license key (The following key only works for one day) jspreadsheet.setLicense('###license###'); // Set the extensions jspreadsheet.setExtensions({ formula }); @Component({ standalone: true, selector: "app-root", template: `
` }) export class AppComponent { @ViewChild("spreadsheet") spreadsheet: ElementRef; // Worksheets worksheets: jspreadsheet.worksheetInstance[]; // Create a new data grid ngAfterViewInit() { // Create spreadsheet this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, { worksheets: [{ data: [ [ "Power", "e^x Result" ], [ 0, "=EXP(A2)" ], [ 1, "=EXP(A3)" ], [ 2, "=EXP(A4)" ], [ -1, "=EXP(A5)" ] ] }] }); } } ```