# Customize Save File Dialog

## Content

SpreadJS allows users to customize the behavior of the **Save File** dialog when importing and saving files in the Spread Designer component. This feature enhances flexibility and efficiency by enabling users to choose the file format and specify file names according to their preferences.

### Default Behavior

By default, when there is content in the Spread file, importing a local file prompts whether to save the current content or not. If you choose to save, the format of the saved file matches the format of the imported file.
**Example**:

1. Import an **Excel file** with content.
2. Then import a **CSV file** from your local system.
    A warning message appears to save your current file changes.
3. Click **Yes**.
    The **Save File** dialog shows .xlsx format to save the current file.

> **Note**: If no file has been imported before, it saves the content in **ssjson**(default) format.

### Customize File Saving Formats

You can set your preferred file saving format using the `saveFileType` parameter in the `setData` method.
Currently, only the following exported file types are supported in [GC.Spread.Sheets.Designer.FileType](/spreadjs/api/v17/designer/enums/GC.Spread.Sheets.Designer.FileType) enumeration.

| Format | Description |
| ------ | ----------- |
| JSON | Specifies the file saving format as json |
| Excel | Specifies the file saving format as .xlsx |
| CSV | Specifies the file saving format as .csv |
| SJS | Specifies the file saving format as .sjs |

Set the file saving format using the `saveFileType` parameter in the `setData` method as shown below.

```javascript
designer.setData("saveFileType", GC.Spread.Sheets.Designer.FileType.Excel);
```

The below output will be generated which allows to save the imported .csv file in .xlsx format only.

![image](https://cdn.mescius.io/document-site-files/images/ef9b66d1-0ae2-4e94-b8cb-f9f893aacc8d/CustomizedSaveFiledialog.a018a8.gif?width=800)

However, to revert to the default import/export save rules, you can set `saveFileType` to **undefined** as shown below.

```javascript
designer.setData("saveFileType", undefined);
```

### Customize File Names

By default, the **Save File** dialog doesn't display any file name when exporting a file. You can set your own file name using the `saveFileName` parameter in `setData` method.

```javascript
designer.setData("saveFileName", "New File");
```

The below output will be generated.

![image](https://gcdocumentsitekrblob.blob.core.windows.net/document-site-files/images/d37fbce1-6a37-43ce-b728-dd79fba68421/image.cc8b0c.png?width=300)

> **Note**:
> File names must follow system rules, such as:
>
> * File names should always be strings.
> * Maximum character length should be 255 for Windows.
> * Avoid use of symbolic characters, such as "<>".
> * Avoid system reserved names.