Free plan

SQL Query

Ask questions of data files with SQL and get a new table
POST
/v1/data/query

About this tool

SQL is a standard language for asking questions of tables of data. This tool runs one SQL SELECT line over your files, which act as tables. You can filter, group, total, sort and join them. Your files are not changed. The answer is a new table.
For example, you list the ten biggest orders from a CSV file.

How to use it

  1. Choose this tool.
  2. Add one or more data files with Upload or drag and drop.
  3. Type your SQL SELECT line, using the table names shown for your files.
  4. Choose the format of the result, then press Generate.
  5. Download the result table.

What you get back

You get a new table with the answer to your question. Download it.
GOOD TO KNOW
One or more files in, one result out. to=json returns the rows inline ({data}); every other format returns a signed download URL. The files are loaded into a temporary in-memory database that only this request can see and that is discarded afterwards; nothing is stored between requests. `tables` may also be sent as a JSON array. Dates are compared as ISO text (2026-03-31T00:00:00.000Z), true/false as 1/0. At most 1,000,000 input rows per request and 200,000 result rows (more -> truncated: true).
TEST IT LIVE

Try SQL Query in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Data
Plan
Free
Method
POST
Endpoint
/v1/data/query
Tool ID
data.query
Authentication
API key
Accepts
XLSX, ODS, MD, HTML, XLS, CSV +9 more
Background jobs
Yes
Usage group
Data
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/data/query" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'files=@document.pdf' \
  -F 'query=SELECT country, COUNT(*) AS orders FROM t1 GROUP BY country' \
  -F 'tables=orders,customers' \
  -F 'to=xlsx'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.data.query({
    "files": 'document.pdf',
    "query": "SELECT country, COUNT(*) AS orders FROM t1 GROUP BY country",
    "tables": "orders,customers",
    "to": "xlsx"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->data()->query([
    'files' => 'document.pdf',
    'query' => 'SELECT country, COUNT(*) AS orders FROM t1 GROUP BY country',
    'tables' => 'orders,customers',
    'to' => 'xlsx',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Run one SQL SELECT over one or more data files: filter, group, total, sort and join them like database tables. Writes the result in any writable format.

SQL Query accepts XLSX, ODS, MD, HTML, XLS, CSV, JSON, XML, TSV, NDJSON, YAML, TOML and 3 more. You can send several files in one request.

SQL Query is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/data/query with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.