Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Excel Import

นำเข้าข้อมูลโควตาการลาจากไฟล์ Excel (.xlsx) เข้าสู่ระบบ ระบบจะอ่านข้อมูลจากไฟล์ที่ดาวน์โหลดจาก Excel Template API และบันทึกพร้อมสร้าง import log

Endpoint

POST /api/v1/open-apis/salary/add-data-filter?path_action=excel_import

Request Body (multipart/form-data)

ParameterTypeRequiredDescriptionExample
_fileUpdfileYesไฟล์ Excel (.xlsx)quota_import.xlsx
select_yearstringYesปีโควตา (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

FieldTypeDescription
all_recordnumberจำนวนรายการทั้งหมดในไฟล์
insert_recordnumberจำนวนรายการที่เพิ่มสำเร็จ
update_recordnumberจำนวนรายการที่อัปเดตสำเร็จ
error_recordnumberจำนวนรายการที่เกิดข้อผิดพลาด
import_log_idstringID ของ log การนำเข้า

Error Response

{ "code": 400, "message": "ไม่สำเร็จ", "errors": ["กรุณาอัปโหลดไฟล์ (_fileUpd)"] }

Code Examples

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 แนะนำให้ตรวจสอบข้อมูลในไฟล์และลองนำเข้าใหม่

  • Excel Template - ดาวน์โหลด template สำหรับนำเข้า
  • Get Import Log - ดูรายการประวัติการนำเข้า
  • Excel Receiving Import - นำเข้าโควตาที่จะได้รับจาก Excel
Last updated on