Developer Function: Server Script: $ps.file.export
## Overview
Used when exporting using "「$ps.file」" in "[Server Script](/en/manual/table-management-server-script)".
## Prerequisites
1. DisableServerScriptFile in "[Script.json](/en/manual/script-json)" must be set to false.
2. "Export permission" for "[Table](/en/manual/table)" is required.
## Syntax
```
$ps.file.export(section, path, siteId, json);
```
## Parameters
|Parameter|Type|Required|Description|
|:----------|:----------|:---:|:---------------------------|
|section|string|Yes|Section name. For details on sections, see "About Sections" in "「$ps.file」". |
|path|string|Yes|File name. For both Windows and Linux, use "/" as the directory separator. |
|siteId|string|Yes|Site ID|
|json|string|Yes|Export parameters|
## Return value
Returns true if successful. Returns false if it fails.
## Exceptions
If an exception occurs in C#, the server script will raise an exception by putting the exception class name and error message into an Error object.
## Usage example
The following example exports a CSV file in the web server and outputs the results to the log.
### (a) Export a table with the standard export settings.
##### JavaScript
```
const siteId = 100;
const param = {
};
const result = $ps.file.export('01_develop', 'parts/01_parts.csv', siteId, $ps.JSON.stringify(param));
context.Log(result);
```
### (b) Character code: Shift-JIS example
##### JavaScript
```
const siteId = 100;
const param = {
Encoding = "Shift-JIS"
};
const result = $ps.file.export('01_develop', 'parts/01_parts.csv', siteId, $ps.JSON.stringify(param));
context.Log(result);
```
### (c) Export a table using the "Export" settings already created in Pleasanter
##### JavaScript
```
const siteId = 100;
const param = {
ExportId: 1
};
const result = $ps.file.export('01_develop', 'parts/01_parts.csv', siteId, $ps.JSON.stringify(param));
context.Log(result);
```
### (d) Export a table by writing directly
##### JavaScript
```
const siteId = 100;
const param = {
Export: {
Columns: [
{
ColumnName: 'ClassA'
},
{
ColumnName: 'UpdatedTime'
}
],
Header: false,
Type: 'csv'
}
};
const result = $ps.file.export('01_develop', 'parts/01_parts.csv', siteId, $ps.JSON.stringify(param));
context.Log(result);
```
## Supported Versions
|Supported versions|Body|
|:--|:--|
|1.4.13.0 and later|Added function|
## Related Information
<div id="ManualList"><ul><li><a href="/en/manual/script-json">Set Parameter: Script.json</a><span>10.02.2024 up</span></li></ul></article>
<ul><li><a href="/en/manual/table">Table Function</a><span>08.13.2024 up</span></li></ul></article>
<ul><li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />