CSV Getter Docs
CSV GetterLoginSign Up
  • Welcome
  • What is CSV Getter?
  • The Export URL
  • Data Sources
    • Connect Airtable
    • Connect Notion
    • Connect Google Sheets
    • Upload Data
  • Destinations
    • Connect to Dropbox
    • Connect to Google Drive
  • Exporting
    • Export Airtable
    • Export Airtable (With Airtable URL)
    • Export Airtable (via API)
    • Export Notion
    • Export Google Sheets
    • Export Uploaded Data
  • Automations
    • Export to Excel (Windows)
    • Export to Google Sheets (Drive)
    • Export to Google Sheets (Direct)
    • Export to Dropbox
    • Export to JSON
    • Export to XML
  • Airtable
    • Linked Records and Lookup Fields
    • Export Shared Airtable View
  • Platform Features
    • URL Parameters
    • The "Type" Parameter
    • The "SQL" Parameter
    • Email Notifications
    • Extract JSON Property
    • Embeddable Wordpress HTML
  • Misc
    • Zapier Code Example
    • Google App Script Snippet
  • Custom Chat GPT Code
Powered by GitBook
On this page
  • Limit records
  • Filter records
  • Sort records by Column
  • Ascending
  • Descending
  • Group records by column
  • FAQs
  • Is my CSV data liable to SQL injection?

Was this helpful?

  1. Platform Features

The "SQL" Parameter

Fine tune your data output in line with this parameter

PreviousThe "Type" ParameterNextEmail Notifications

Last updated 9 months ago

Was this helpful?

The SQL url parameter (?sql=) can be used to filter, sort or group the data export. Below are examples of how it can be used to restructure your data.

Example Export URL

Output (CSV)

Name,Age,Gender,Occupation
John Doe,35,Male,Engineer
Jane Smith,28,Female,Doctor
Michael Johnson,42,Male,Teacher
Emily Brown,31,Female,Software Developer
David Wilson,45,Male,Manager

Limit records

?sql=select * from csvgetter limit 1 (if first parameter)

&sql=select * from csvgetter limit 1 (if not first parameter)

What does it do?

Only shows the first row of data. (To show the first n rows change to limit n)

Example

Name,Age,Gender,Occupation
John Doe,35,Male,Engineer

Filter records

?sql=select * from csvgetter where <column_name>='<value>' (if first parameter)

&sql=select * from csvgetter where <column_name>='<value>' (if not first parameter)

What does it do?

Only shows data where <column_name> is equal to <value>.

Example

Name,Age,Gender,Occupation
Michael Johnson,42,Male,Teacher

Sort records by Column

Ascending

?sql=select * from csvgetter order by <column_name> asc (if first parameter)

&sql=select * from csvgetter order by <column_name) asc (if not first parameter)

Descending

?sql=select * from csvgetter order by <column_name> desc (if first parameter)

&sql=select * from csvgetter order by <column_name) desc (if not first parameter)

What does it do?

Orders the data by the selected column name

Example

Name,Age,Gender,Occupation
Jane Smith,28,Female,Doctor
Emily Brown,31,Female,Software Developer
John Doe,35,Male,Engineer
Michael Johnson,42,Male,Teacher
David Wilson,45,Male,Manager

Group records by column

?sql=select Gender, count(*) as 'Number of records' from csvgetter group by Gender (if first parameter)

&sql=select Gender, count(*) as 'Number of records' from csvgetter group by Gender (if not first parameter)

What does it do?

Groups the records by gender, counts the number of records that matches each gender.

Example

Gender,Number of records
Female,2
Male,3

With our encoder tool:

select Gender, count(*) as 'Number of records' from csvgetter group by Gender

becomes...

select%20Gender%2C%20count(*)%20as%20'Number%20of%20records'%20from%20csvgetter%20group%20by%20Gender

and can be used like:

Generally speaking, CSV Getter API can accept any read-only (SELECT) SQL statements. Think of any other cool SQL to include in this page? Let us know!

FAQs

Is my CSV data liable to SQL injection?

No. We have designed the system such that SQL only works read-only, and does not interact with the underlying data.

?sql=select * from csvgetter limit 1

?sql=select * from csvgetter where Occupation='Teacher'

?sql=select * from csvgetter order by Age asc

?sql=select Gender, count(*) as 'Number of records' from csvgetter group by Gender

A SQL statement like this will introduce special characters like ` or * into the URL. You can encode your SQL statements with our .

?sql=select%20Gender%2C%20count(*)%20as%20'Number%20of%20records'%20from%20csvgetter%20group%20by%20Gender

https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX
https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX
https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX
https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX
https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX
⚠️
URL Encoder/Decoder tool
https://api.csvgetter.com/AADVgE0BE2k04FgjZJtX