Developer Function: Server Script: $ps.file.import
## Overview
Used when importing 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. "Import permission" is required for "[Table](/en/manual/table)".
## Syntax
```
$ps.file.import(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|Import parameters|
## Return Value
Returns the number of new registrations and the number of updates if successful. Returns null if unsuccessful.
## 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 imports a CSV file from the web server and outputs the results to the log.
##### JavaScript
```
const siteId = 100;
const param = {
};
const result = $ps.file.import('01_develop', 'parts/01_parts.csv', siteId, $ps.JSON.stringify(param));
context.Log($ps.JSON.stringify(result));
```
##### Example output
```
{insertCount:10,updateCount:0}
```
Character code: Shift-JIS example
```
const siteId = 100;
const param = {
Encoding: 'Shift-JIS'
};
const result = $ps.file.import('01_develop', 'parts/01_parts.csv', siteId, $ps.JSON.stringify(param));
context.Log($ps.JSON.stringify(result));
```
##### Example output
```
{insertCount:10,updateCount:10}
```
Example of updating records with matching keys
```
const siteId = 100;
const param = {
UpdatableImport: true,
Key: 'ClassA'
};
const result = $ps.file.import('01_develop', 'parts/01_parts.csv', siteId, $ps.JSON.stringify(param));
context.Log($ps.JSON.stringify(result));
```
##### Output example
```
{insertCount:10,updateCount:10}
```
## 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="" />