Get started with alasql CDN

MIT licensed

Alasql is a client-side library for working with structured data using SQL-like queries.

Tags:
  • sql
  • nosql
  • graph
  • alasql
  • javascript
  • parser
  • database
  • DBMS
  • data
  • query
  • localStorage
  • IndexedDB
  • DOM-storage
  • SQLite
  • JSON
  • Excel
  • XLSX
  • XLS
  • CSV
  • webworker

Stable version

Copied!

How to start using alasql CDN


<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.cdnhub.io/alasql/4.3.0/alasql.min.js"></script>
</head>
<body>
  <script>
    // Define data as a 2-dimensional array
    const data = [
      ['Name', 'Age', 'City'],
      ['John', 25, 'New York'],
      ['Jane', 30, 'Chicago'],
      ['Mike', 35, 'Los Angeles']
    ];

    // Use alasql to convert the data into a Google Sheets-like spreadsheet
    const spreadsheet = alasql('SELECT * FROM ?', [data]);

    // Perform a calculation using alasql
    const sumOfAges = alasql('SUM(?[?A])', {data: data, A: 'Age'});

    // Log the result to the console
    console.log('Sum of ages:', sumOfAges);

    // Update a cell value using alasql
    alasql('UPDATE ? SET [1, 1] = "John Doe"', [{Name: ['Name'], Age: ['Age'], City: ['City'], '0': ['John'], '1': ['Age']}]);

    // Log the updated data to the console
    console.log('Updated data:', spreadsheet.getData());
  </script>
</body>
</html>
Copied!

All versions