Excel Import
นำเข้าข้อมูลโควตาการลาจากไฟล์ Excel (.xlsx) เข้าสู่ระบบ ระบบจะอ่านข้อมูลจากไฟล์ที่ดาวน์โหลดจาก Excel Template API และบันทึกพร้อมสร้าง import log
Endpoint
POST /api/v1/open-apis/salary/add-data-filter?path_action=excel_importRequest Body (multipart/form-data)
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
_fileUpd | file | Yes | ไฟล์ Excel (.xlsx) | quota_import.xlsx |
select_year | string | Yes | ปีโควตา (YYYY) | "2026" |
Content-Type ต้องเป็น multipart/form-data (ไม่ใช่ application/json)
Response Format
Success Response
{
"code": 200,
"message": "Import Quota Success",
"payload": {
"all_record": 150,
"insert_record": 145,
"update_record": 3,
"error_record": 2,
"import_log_id": "IMP20260220001"
}
}Response Fields
| Field | Type | Description |
|---|---|---|
all_record | number | จำนวนรายการทั้งหมดในไฟล์ |
insert_record | number | จำนวนรายการที่เพิ่มสำเร็จ |
update_record | number | จำนวนรายการที่อัปเดตสำเร็จ |
error_record | number | จำนวนรายการที่เกิดข้อผิดพลาด |
import_log_id | string | ID ของ log การนำเข้า |
Error Response
{
"code": 400,
"message": "ไม่สำเร็จ",
"errors": ["กรุณาอัปโหลดไฟล์ (_fileUpd)"]
}Code Examples
cURL
curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/salary/add-data-filter?path_action=excel_import" \
-H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
-F "_fileUpd=@/path/to/quota_import.xlsx" \
-F "select_year=2026"Notes
- ไฟล์ต้องเป็น
.xlsxเท่านั้น - ดาวน์โหลด template จาก Excel Template ก่อนกรอกข้อมูลเพื่อให้แน่ใจว่ารูปแบบถูกต้อง
- ระบบจะสร้าง import log อัตโนมัติเพื่อติดตามผลการนำเข้า
- ถ้ามี
error_record> 0 แนะนำให้ตรวจสอบข้อมูลในไฟล์และลองนำเข้าใหม่
Related APIs
- Excel Template - ดาวน์โหลด template สำหรับนำเข้า
- Get Import Log - ดูรายการประวัติการนำเข้า
- Excel Receiving Import - นำเข้าโควตาที่จะได้รับจาก Excel
Last updated on