Skip to content

Data Preview Sheets

David Megginson edited this page Feb 13, 2020 · 2 revisions

The HXL Proxy's Data-preview-sheets service returns a list of the sheet indices and names in a Microsoft Excel workbook. The service is located at https://proxy.hxlstandard.org/api/data-preview-sheets.json (for JSON output) and https://proxy.hxlstandard.org/api/data-preview-sheets.csv (for CSV output), and accepts the following GET parameters:

Parameter Is required? Description
url yes URL of the dataset to preview (must be publicly readable)
force no If the value is "on", skip caching (defaults to a one-hour cache for both input and output)

The results include a CORS header to allow in-browser Javascript use.

Note that there is no data preview in the output, only the sheet names and indices (you can get the contents of each sheet using the Data preview service). If the data source not a Microsoft Excel file, the service will list a single sheet with the name "Default."

Examples

List the sheets in the Excel workbook at https://data.humdata.org/dataset/mpi-in-syria in JSON format:

https://proxy.hxlstandard.org/api/data-preview-sheets.json?url=https%3A%2F%2Fdata.humdata.org%2Fdataset%2Fmpi-in-syria

List the same sheets with the output in CSV format (UTF-8 character encoding):

https://proxy.hxlstandard.org/api/data-preview-sheets.csv?url=https%3A%2F%2Fdata.humdata.org%2Fdataset%2Fmpi-in-syria

Retrieve the contents of the first sheet (index 0) using the Data preview service API endpoint:

https://proxy.hxlstandard.org/api/data-preview.json?sheet=0&url=https%3A%2F%2Fdata.humdata.org%2Fdataset%2Fmpi-in-syria

Clone this wiki locally