@extends('backend.layouts.app') @section('title', 'Import Departments') @section('content') @php $pageTitle = 'Import Departments'; $indexRoute = 'content-directory-department.index'; $indexLabel = 'Departments'; @endphp @include('backend.layouts.partials._page_header')
Upload a file to preview and validate rows before inserting or updating departments.
1. Download
Use the Excel or CSV template so the headers match exactly.
2. Fill rows
One department per row. Use a unique code and both BM/EN names.
3. Preview
The system validates every row and shows what will be inserted or updated.
4. Confirm
Only valid files can be imported. All rows are saved in one database transaction.
Insert or update: if a row's code already exists, that department is updated. If the code is new, a new department is inserted.
All-or-nothing: if one row is invalid, nothing is written. Fix the file and upload it again.
Use the template so the column names and sample hierarchy are correct.
TKSU (KA) → BPI → SDPI) and match the department codes used in the Staff import template (BPM, SDPI) — import departments first, then staff.| Column | Required | What it means | Example |
|---|---|---|---|
code |
Yes | Unique department code. Used to match existing departments and as the target for parent_code. |
BPI |
name_bm |
Yes | Department name in Bahasa Malaysia. Shown in the BM interface. | Bahagian Perubahan Iklim |
name_en |
Yes | Department name in English. Shown in the English interface. | Climate Change Division |
parent_code |
No | Code of the parent department. Leave blank for a root department. Any existing department (or one in the same file) can be the parent — there is no depth limit. | TKSU (KA) |
sort |
No | Display order within the same parent. Blank is saved as 0. |
1 |
Existing departments are matched by code and updated. New codes are inserted. If any row is invalid, nothing will be imported.