The system determines how to process files based on the file types you configure. In the File Type configuration, you can set the file format and the processing mode for the file (such as importing into the database and copying the file to the archive folder).
In MailAttachmentBot Manager, click the "File Type Config" icon to open the file type list.
In this list, click the "Add File Type" button to open the "Edit File Type" dialog box.
Edit File Type dialog box
In this dialog box:
File Type Name |
Enter the name of the file type. File Type Name is case-insensitive and must be unique. |
File Processing Mode |
Choose a file processing mode. The system will process the files according to the method you specify. File Processing Mode includes the following options: "Import the file into the database and copy it to the specified directory": The system will import the file into the PostgreSQL database and copy the file to the directory specified in "Copy Processed Files To". "Only import the file into the database":The system will only import the file data into the PostgreSQL database for storage. "Only copy the file to the specified directory":The system will only copy the file to the directory specified in "Copy Processed Files To." Note: The "Import the file into the database" option is only valid for text files and spreadsheet files (*.xlsx and *.xlsm). Other types of files cannot be imported into the database. The imported data will be stored in your SQLMessenger's PostgreSQL database. |
Sheet Name |
Enter the name of the Sheet to be imported into the database. Sheet Name is case-insensitive and must be unique. You only need to set either the Sheet Name or the Sheet Index. If both the Sheet Name and Sheet Index are set, the Sheet Name will take precedence. If neither the Sheet Name nor the Sheet Index is set, the system will import data from the first sheet of the file. This option is not valid for text files. |
Sheet Index |
Enter the 1-based index number of the sheet in the spreadsheet to be imported into the database. Sheet Name is case-insensitive and must be unique. You only need to set either the Sheet Name or the Sheet Index. If both the Sheet Name and Sheet Index are set, the Sheet Name will take precedence. If neither the Sheet Name nor the Sheet Index is set, the system will default to importing data from the first sheet of the file. This option is not valid for text files. |
Columns to be Imported |
Click the button on the right side of the text box to configure the column names in the file. Column names are case-insensitive. If the "Columns to be Imported" list is set and the "The row at the 'Start Row Index' is the header row" and "Require all columns to be present in data file" option are checked, the system will check whether all the column names configured in the "Columns to be Imported" list appear when processing this type of file. If any column names are missing, the system will stop processing the file and report an error. You can specify the data type for each column, which can be "Text," "DateTime," or "Numeric." The system will perform different conversions based on the data type of the column during file processing. If the "Columns to be Imported" list is not set, the system will import all data from the columns after the Start Column Index in the Start Row Index row of the sheet, treating the contents of the first row of the sheet as column names. |
Start Row Index |
Set the starting row for reading data, with a 1-based index. The system will start reading data from this row in the file. If this field is empty, the system will start reading from the first row. |
The row at the "Start Row Index" is the header row |
Indicate whether the row at the Start Row Index in this file is a header row. If this option is checked, the system will skip the row at the Start Row Index and start reading data from the next row. If this option is checked and the "Columns to be Imported" field is left blank, the system will use the content of cells read from the "Start Row Index" as column headers. If the "Columns to be Imported" field is set and the "The row at the 'Start Row Index' is the header row" option is checked, the "Start Column Index" field will be ignored. The system will use the index of the first column in the "Columns to be Imported" as the Start Column Index and read data from this column onward. |
All columns listed in "Columns to be Imported" must exist in the data file |
If this option is checked, the system will check whether all the data columns configured in "Columns to be Imported" are present in the data file before importing. If any data columns are missing, the system will stop the import process and report an error. |
Start Column Index |
Set the starting column for reading data using a 1-based index. The system will start reading data from this column. If this field is empty, the system will start reading from the first column. If the "Columns to be Imported" field is set and the "The row at the 'Start Row Index' is the header row" option is checked, the system will ignore the "Start Column Index" field, use the index of the first column in the "Columns to be Imported" as the "Start Column Index", and read data from this column onward. |
Field Separator for Text File |
Enter the field separator for text file. This setting is only valid for text files. The field separator must be a single character and cannot be a double quotation mark. If this field is left empty, the system will use the "," as the field separator. |
Charset for Text File |
Set the character set for text file. This setting is only valid for text files. If this field is left empty, the system will use UTF-8 encoding to process the text file. |
Run Task After File Imported |
Enter the name of the task to be executed after the file is successfully imported into the database. Task names are case-insensitive. When the system initiates this task, it will pass the file's file_id as a parameter to the task to be executed. If this field is empty, no task will be executed after the file is successfully imported. |
Copy Processed Files To |
Set a directory where the system will copy and store files of this type after processing, e.g., D:\MyData . If this field is left empty, the file will not be copied. If the specified directory does not exist, the system will automatically create it. |
Set "Columns to be Imported" (Column List)
You can configure the list of columns that will appear in the file in the File Type Config. The system will use the Column List you set to determine which columns will be imported into the database.
You can also set the data type for each column. When exporting the data to a spreadsheet, the system will export the file data according to the data type you set.
To open the "Edit Columns" dialog box, click the button next to the "Columns to be Imported" text box in the File Type Config dialog box.
Edit Columns dialog box
Batch Add Columns to Column List
If you need to add multiple columns, you can use the "Batch Add Columns" feature to add columns in bulk.
Step1: Select the columns to add from your template file (e.g., a spreadsheet or text file), then click "Copy".
Step2: In the "Edit Columns" dialog box, click the "Batch Add Columns" button.
Step3: In the text box, press Ctrl+V to paste the column information, and select a field delimiter (Tab). For columns copied from Excel, you can use the default delimiter. Then click "OK".
The plugin will add the columns to the Column List. You can set the data type for each column. Then click "OK" to save the Column List.
You can set the data type for each column in the file to be imported into the database. When you export the file data from the File Manager, the system will export the data according to the data type you set. Setting the correct data type is important for processing this data later in spreadsheets.
The system supports the following data types:
Text |
Exports data as text. This is the default processing method. |
Numeric |
Exports data as numbers in the spreadsheet. If the data contains non-numeric content, the export will fail. |
DateTime |
Exports data as date and time in the spreadsheet. If the data contains non-date-time content, the export will fail. |