Sheets2JSON is a simple service that provides a read-only REST endpoint for any publicly accessible Google Sheet, .xlsx/.xls, or .csv document. This api will attempt to return the provided Sheet data in structured JSON. Pass in any remote document or Google Sheet url and recieve a structured JSON response.
Obtain a link to any pubilc .xlsx/.xls, .csv, or Google Sheet
Make a GET request and pass the public url to the Sheets2Json endpoint as the url
parameter
Recieve a structured JSON response with the target sheet row values as an array
This API service consists of a single supported endpoint and is read-only. You can pass in specific query parameters that can be used to modify the JSON responses, for example adding custom headers
(column names or keys) to override the remote documents. You can also use order
and orderby
to sort the JSON object in the response. Lastly, for documents that have multiple workbooks/sheets, you can pass in a sheet
parameter and the name of the desired Sheet to return. By default the first sheet in the document will always be returned.
There is only one single supported endpoint:
https://api.sheets2json.com/v1/doc/?url=REMOTE_DOC_URL
Make a GET request to this endpoint where url
is a valid publicly accessible xlsx, xls, csv, or Google Sheet link. The url
parameter is the only required parameter that needs to be present on every request. Additional supported query parameters can be found below, and can be used to customize or mutate the response from the API.
Below are two examples for what the API would be expecting for the url
parameter:
https://yourdomain.com/path/to/file.csv
https://yourdomain.com/path/to/file.xlsx
https://docs.google.com/spreadsheets/d/SHEET_ID_WILL_BE_HERE/edit
There are five(5) supported query parameters for the above endpoint:
Parameter | Type | Required | Description |
---|---|---|---|
url |
String | Yes | Full url to document (see above for examples). |
headers |
Boolean | String | No | Can be a boolean (1 ), or list of keywords sperated by a comma (key1,key2,key3, ... ). This option will let you customize the JSON keys without the need to update the remote document. Any spaces or hypens in the keywords will be automatically replaced with underscores ( _ ). Setting headers to 1 will use the first item in the array as the keys for all other items. |
orderby |
String | No | Sort resulting data array by speficic object key. |
order |
String | No | Supports asc (default) and desc values. Order results in ascending or descending order. |
sheet |
String | No | Sheet name of desired worksheet in the document. If no sheet specified, the first sheet in the document will be used. |
Below are a few examples of how to interact with the API and what to expect as a response. All examples are using the same Google Sheet as the data source: https://docs.google.com/spreadsheets/d/15g64-KCC94m0PMlZJevaoUB84a71zIlVaVIhcD-Ey-4/edit
.
For any issues/bugs you may come accross, or to simply suggest a new feature, you can create an issue on the offical Github Repo.