--- title: "Export" slug: "export-1" updated: 2025-01-09T16:42:50Z published: 2025-01-09T16:42:50Z canonical: "docs.datajet.app/export-1" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # Export Exports data into a file. | Key | Value(s) | Description | | --- | --- | --- | | method | "Export" | Exports data into file | | all | true/false | Optional. Default = false. If true, all fields in the table will be exported. *NOTE: cannot be used at the same time as fields[], template or exportTemplate* | | asynchUpload | | | | audit | true/false | Added in v 5.7.18 Optional. Default = false. If true, creates an audit penetration file of exported data. Only works with **fields**[] option - will be ignored if using "**all**" ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736177584510.png)Audit processing timeBe aware of the additional processing time required when adding an audit to an export, particularly on wide tables. | | createImportScript | true/false | Optional. Default = false. If true, a [CreateTableFromFile](/v1/docs/createtablefromfile) method is added to **file [exportFileName].json** | | dataset {} | {} | Required. Determines the data to export. The simplest form of a dataset will be for all records in a table: ```json "dataSet": { "logic": "or", "name": "01_KJV_BOOK_SUMMARY", "strict": true, "set": [ { "logic": "or", "stype": "TABLE", "entity": "01_KJV_BOOK_SUMMARY" } ] }, ``` Note: It is **not recommended** to edit dataset JSON by hand - instead, drag a [dataset](/v1/docs/dataset) from the [Project Explorer](/v1/docs/project-explorer-overview) or [HotBar](/v1/docs/dataset-hotbar-quick-reference) and drop on the Export method's [JSON window](/v1/docs/script-editor). | | delimiter | - Tab - Comma - Semi-colon - Pipe - HSTART | Optional. Default = Comma The following delimiters are supported: - Tab - Comma - Semi-colon - Pipe - HSTART ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736176724843.png) | | eid | "stringID" | an optional id string assigned by the calling application and stored in the export log entry | | exportAlternateFields | true/false | Optional. Default = false If true, fields in the export list that *have been* [*decoded*](/v1/docs/bulkdecode) (and therefore have an underlying source field) will export the source data rather than the decoded data. For example, rather than exporting "California", the source value of "CA" will be exported. NOTE: exportAlternateFields only takes effect if the project has been configured to export source fields using [SetProjectProperties](/v1/docs/setprojectproperties) | | exportFileName | | Required. The name of the file to output. - If the file already exists and **overwrite** = false, an error will be raised. - Export will still occur if extension is missing - note there is no verification that supplied file extension (e.g., .txt) matches specified **delimiter**. - If no path is supplied, file location will be the [output](/v1/docs/system-variables) folder. - If an invalid path is supplied, error message "cannot open file for writing" will be generated. - Depending on settings for **audit** and **infoAudit**, export summary files of the format [exportFileName]_DSTAMP.info.json will be generated. | | exportHeaders | true/false | Default = false. If true, first row of generated file will contain header data: ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736176348493.png) | | exportTemplate | | | | fields[] | [ "table1.field1" "table1.field2" "..." ] | Optional. List of fields to export. - Field names must be fully qualified. - All fields must come from the same table. | | infoAudit | true/false | Default = false. If true, an [info audit](/v1/docs/export-1#example-info-audit-report) file will be created. | | overwrite | true/false | Default = false. If true, file will be overwritten if it exists. | | quotedStringExport | true/false | Default = false. If true strings will be will be in quotes. ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736176532705.png) | | start | 0 | Optional. Default = 0 Determines the URN number of the first line to output. ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736254490924.png)![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736254435483.png) | | template | "Template_name" | Optional. Default = "" Name of field template that contains the fields to export. Use instead of "all", "fields" and "exportTemplate". - The field template owner table must match the owner table of dataset. - Use JSON helper to select from existing templates. ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736254765833.png) | | upload | | | | urns | true/false | Default = false. If true, urn will be included. NOTE: This only works with "fields" - it does not work with "all" | | project | | | ### Output Files The following output files may/will be created: - **Data File** - always created  **[exportFileName]** - **Export Summary report** - always created **[exportFileName].info.json** - **Audit Spreadsheet** - generated if **audit**=true  **[exportFileName].xlsx** - **Info Audit report** - extended version of export summary report, generated if **infoAudit** = true  **[exportFileName].info.json** - **Load Script** - generated if **c****reateImportScript** is true  **[exportFileName].json** ### Examples #### Blank Method ```json { "method": "Export", "project": "", "exportAlternateFields": false, "urns": false, "exportHeaders": false, "quotedStringExport": false, "createImportScript": false, "exportFilename": "", "eid": "", "delimiter": "Tab", "fields": [], "all": false, "exportTemplate": "", "template": "", "audit": false, "dataSet": {}, "overwrite": false, "start": 0, "upload": false, "asyncUpload": false, "infoAudit": false } ``` #### Example method ```json { "method": "Export", "exportHeaders": false, "urns": false, "quotedStringHeaders": false, "overwrite": true, "eid": "60ada34aef4fbbe9c771946a", "tabDelimited": true, "createImportScript": false, "fields": [ "%MODEL%%STABLE%TEMP.%XFIELD%", "%MODEL%%STABLE%TEMP.%YFIELD%" ], "dataSet": { "logic": "or", "name": "SubSet", "strict": true, "set": [ { "logic": "or", "stype": "TABLE", "entity": "%MODEL%%STABLE%TEMP" } ] }, "exportFilename": "%DATAPATH%%XFIELD%_%YFIELD%%DSTAMP%.txt", "project": "Demonstration" } ``` #### Export Summary report Exporting to file will automatically generate an export summary file: ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736176052710.png) #### Example Audit Report The Audit report is an excel file that summarizes the data that has been export in 2 forms: - Fields - summary data for each exported field - Penetration - value counts for each discrete field. Control audit file output using the "**audit**" option ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736261129328.png)Fields ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736261163051.png)Penetration See also: - [Data Audit](/v1/docs/data-audit) - [Audit](/v1/docs/audit) method #### Example Info Audit Report The info audit report is a summary report with additional information concerning [atomic fields](/v1/docs/atomic-fields): - atomicDatasetFields - atomic fields used in generating the dataset. - atomicFieldDetail - atomic fields used in generating the output fields. Control Info Audit using the **infoAudit** option. ```json { "records": 66, "length": 3563, "filename": "MyTestFile_infoaudit.txt", "atomicExportFields": [ "01_KJV_BOOK_SUMMARY.BookTestament", "01_KJV_BOOK_SUMMARY.BookOrdinal", "01_KJV_BOOK_SUMMARY.BookTitle" ], "infoFilename": "d:/.../dj-localhost/output/MyTestFile_infoaudit.txt_20250107115315.info.json", "resolvedFilename": "d:/.../dj-localhost/output/MyTestFile_infoaudit.txt", "atomicDatasetFields": [], "user": "aaa@company.com", "realm": "dj-localhost", "dateCreated": "2025-01-07 11:53:15", "host": "NAME", "atomicFieldDetail": [ { "field": "01_KJV_BOOK_SUMMARY.BookTestament", "notnull": 66 }, { "field": "01_KJV_BOOK_SUMMARY.BookOrdinal", "notnull": 66 }, { "field": "01_KJV_BOOK_SUMMARY.BookTitle", "notnull": 66 } ], "request": { "method": "Export", "exportAlternateFields": false, "urns": false, "exportHeaders": false, "quotedStringExport": true, "createImportScript": true, "eid": "", "audit": true, "overwrite": false, "start": 0, "upload": false, "asyncUpload": false, "infoAudit": true, "all": true, "dataSet": { "logic": "or", "name": "01_KJV_BOOK_SUMMARY", "strict": true, "set": [ { "logic": "or", "stype": "TABLE", "entity": "01_KJV_BOOK_SUMMARY" } ] }, "project": "BibleProject2", "exportFilename": "d:/datajet/dj-localhost/output/MyTestFile_infoaudit.txt", "fields": [ "01_KJV_BOOK_SUMMARY.BookTestament", "01_KJV_BOOK_SUMMARY.BookOrdinal", "01_KJV_BOOK_SUMMARY.BookTitle" ] } } ``` #### Example load script Generated if createImportScript is true: ![](https://cdn.document360.io/73b6469b-c1e4-47e9-aa65-986c8ebd17ca/Images/Documentation/image-1736267313020.png) #### Error messages | Error | Possible Cause(s) | | --- | --- | | request must contain only one of 'fields', 'all', 'template' or 'exportTemplate' | too many properties have been included in the call - keep one, and remove the others. | | a file with that name already exists | provide a different value for **exportFilename** or set **overwrite** to *true*. | | no fields selected for export | provide one of the following: **fields**, **all**, **template**, **exportTemplate** | | ambiguous field name [] is not a field | make sure "fields" contains fully qualified field names, including the table. | | export template not found | "**template**" or "**exportTemplate**" points to an invalid field template. | | cannot open file for writing | invalid path specified for **exportFileName** |