Export coded results as Excel (.xlsx)
const url = 'https://api.surveycoder.io/v2/export/excel';const options = { method: 'POST', headers: { 'X-Request-Id': '550e8400-e29b-41d4-a716-446655440000', 'x-api-key': '<x-api-key>', 'Content-Type': 'application/json' }, body: '{"project_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","question_ids":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"layout":"wide_by_question","include_categories":true,"include_sentiment":false,"include_confidence":true,"include_demographics":true,"include_code_dictionary":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.surveycoder.io/v2/export/excel \ --header 'Content-Type: application/json' \ --header 'X-Request-Id: 550e8400-e29b-41d4-a716-446655440000' \ --header 'x-api-key: <x-api-key>' \ --data '{ "project_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "question_ids": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "layout": "wide_by_question", "include_categories": true, "include_sentiment": false, "include_confidence": true, "include_demographics": true, "include_code_dictionary": true }'Generate an Excel file with coded results. Supports four layout modes and toggleable columns for categories, sentiment, confidence, and demographics. Includes a Code Dictionary sheet by default.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ”Example
550e8400-e29b-41d4-a716-446655440000Client-generated request ID for tracing. Returned as-is in the
response X-Request-Id header.
Request Body required
Section titled “Request Body required ”Options for Excel or CSV export.
object
Project to export.
Specific question IDs to include. When omitted, all coded questions in the project are exported.
Data layout:
wide_by_question— One row per respondent, codes as columns grouped by question.columns_by_mention— One row per respondent, separate columns for 1st mention, 2nd mention, etc.binary_dummy— One row per respondent, one 0/1 column per code.one_row_per_code— One row per response-code pair (long format).
Include category name column.
Include sentiment column.
Include confidence column.
Include demographic/metadata columns from the original data.
Include a Code Dictionary sheet (Excel only, ignored for CSV).
Responses
Section titled “ Responses ”Excel file download
Headers
Section titled “Headers ”Example
attachment; filename="Brand Study.xlsx"Suggested filename for the download.
Request body failed validation.
Standard error envelope.
object
object
Machine-readable error code. See the error reference for the full list.
Human-readable explanation of what went wrong.
Echo of the X-Request-Id header, when provided.
Link to documentation for this specific error code.
Example
{ "success": false, "error": { "code": "VALIDATION_ERROR", "message": "responses array is required and must not be empty", "doc_url": "https://docs.surveycoder.io/errors/validation-error" }}Missing or invalid API key.
Standard error envelope.
object
object
Machine-readable error code. See the error reference for the full list.
Human-readable explanation of what went wrong.
Echo of the X-Request-Id header, when provided.
Link to documentation for this specific error code.
Example
{ "success": false, "error": { "code": "UNAUTHORIZED", "message": "x-api-key header is required", "doc_url": "https://docs.surveycoder.io/errors/unauthorized" }}Resource not found.
Standard error envelope.
object
object
Machine-readable error code. See the error reference for the full list.
Human-readable explanation of what went wrong.
Echo of the X-Request-Id header, when provided.
Link to documentation for this specific error code.
Example
{ "success": false, "error": { "code": "NOT_FOUND", "message": "Project not found", "doc_url": "https://docs.surveycoder.io/errors/not-found" }}