Skip to main content

Bulk Operations

This guide covers all bulk scheduling operations in Shyfts: template-based creation, copying weeks, CSV import/export, and bulk editing.


Who Can Use Bulk Operations?

OperationSystem AdminCompany ManagerStaff
Template CreateYesYes (own company)No
Copy WeekYesYes (own company)No
CSV ImportYesYes (own company)No
CSV ExportYesYes (own company)No
Bulk EditYesYes (own company)No
note

Staff members cannot perform any bulk operations. Company Managers can only manage shifts within their own company.


Accessing Bulk Operations

  1. Navigate to DashboardScheduling
  2. Click the Bulk Scheduling button in the calendar header
  3. A modal opens with three tabs: Template, Copy Week, Import CSV

For Bulk Edit, select multiple shifts in the calendar first, then click the Bulk Edit button that appears.

For CSV Export, use the Export function from the calendar view.


Template Mode

What It Does

Generates multiple shifts from a pattern. You define a date range, time window, shift type, which days of the week, and which staff members — and the system creates all the individual shifts in one go.

Step-by-Step

1. Set the Date Range

FieldDefaultDescription
Start DateTodayFirst day to create shifts
End Date7 days from todayLast day to create shifts

2. Define the Shift Pattern

FieldFormatDescription
Start TimeHH:mm (24-hour)When the shift begins
End TimeHH:mm (24-hour)When the shift ends
Shift TypeDropdownSee shift types table below

3. Select Days of Week

Click the day buttons to toggle. Defaults to Monday–Friday.

ButtonDay
MonMonday
TueTuesday
WedWednesday
ThuThursday
FriFriday
SatSaturday
SunSunday

4. Select Staff Members

Use the searchable staff list to choose one or more active staff members. Options:

  • Search by name or email
  • Select All to add everyone
  • Clear to deselect all

5. Select a Room (Required)

Choose the room these shifts will be assigned to. Only active rooms for your company are shown.

6. Review the Preview

The preview shows how many shifts will be created:

"Will create X shifts for Y staff members in [Room Name]"

The formula: (matching days in range) × (number of staff) = total shifts

7. Click "Create Shifts"

Shift Types

TypeUse Case
RegularStandard working shift
OvertimeExtra hours beyond contract
On CallAvailable but not on-site
EmergencyUrgent cover
TrainingTraining and development
MeetingTeam meetings, reviews
BreakScheduled break period

Example

Scenario: Create shifts for 2 staff, Monday–Friday, for one week.

  • Date Range: 23/03/2026 – 27/03/2026
  • Time: 09:00 – 17:00
  • Type: Regular
  • Staff: Dr Sarah Smith, Nurse Amy Jones
  • Room: Surgery 1

Result: 5 days × 2 staff = 10 shifts created

Limits and Behaviour

  • Maximum 365 shifts per template creation
  • Conflicting shifts are automatically skipped (not blocked)
  • Overnight shifts are supported — if end time is before start time, the system adds 1 day to the end
  • A progress overlay shows real-time creation status

Copy Week

What It Does

Duplicates all shifts from a source week to a target week. Staff assignments, rooms, shift types, and notes are preserved. Status is always reset to Scheduled.

Step-by-Step

1. Select Source Week — the week to copy FROM (shows Monday start date)

2. Select Target Week — the week to copy TO (must be a different week)

3. Configure Conflict Handling

  • Skip conflicting shifts (checkbox): When checked, shifts that overlap with existing shifts in the target week are silently skipped. When unchecked, if conflicts are detected, a Retry & Skip Conflicts button appears.

4. Optional Filters

FilterPurposeDefault
Staff FilterOnly copy shifts for selected staffAll staff (empty)
Room FilterOnly copy shifts in selected roomsAll rooms (empty)

5. Review Copy Summary — shows the source and target week date ranges

6. Click "Copy Shifts"

What Gets Copied

FieldCopied?Notes
Staff assignmentYesSame staff member
Room assignmentYesSame room
Start/End timeYesOffset by the week difference
Shift typeYesPreserved
NotesYesPreserved
RequirementsYesDeep-copied
StatusNoAlways reset to "Scheduled"
Recurring settingsNoNot copied

Conflict Handling

When conflicts are detected:

  1. First attempt — if "Skip conflicts" is unchecked, you see a list of conflicting shifts with a "Retry & Skip Conflicts" button
  2. Retry — click the button to re-run, this time skipping all conflicting shifts and creating only the non-conflicting ones
tip

If you know the target week already has some shifts, check "Skip conflicting shifts" before copying to avoid the two-step process.


CSV Import

What It Does

Upload a CSV file containing shift data. Staff members are matched by email address or full name. Rooms are matched by name. All lookups are case-insensitive and scoped to your company.

CSV Column Reference

Your CSV must include these headers (case-insensitive, spaces and dashes are converted to underscores automatically):

ColumnRequiredFormatDescription
dateYesDD/MM/YYYY or YYYY-MM-DD or DD-MM-YYYYThe calendar date of the shift
start_timeYesHH:mm (24-hour)When the shift starts
end_timeYesHH:mm (24-hour)When the shift ends
staff_emailNoEmail addressStaff member's email — used for matching
staff_nameNoFirst LastStaff member's full name — used as fallback
room_nameNoTextRoom name — matched against your company's rooms
shift_typeNoSee types belowDefaults to regular if omitted
notesNoFree text (max 500 chars)Additional information
warning

At least one of staff_email or staff_name should be provided per row. The system tries email first, then falls back to name. Rows without a matched staff member are either skipped or flagged as errors.

Valid shift type values (lowercase in CSV): regular, overtime, on_call, emergency, training, meeting, break

Fields Set Automatically

These are handled by the system — do not include them in your CSV:

FieldValue
CompanyYour logged-in company
StatusAlways scheduled
IDAuto-generated
TimestampsAuto-set

Download the CSV Template

Click "Download CSV Template" in the Import CSV tab. The template is pre-populated with your company's actual rooms and staff members, so you can fill it in without looking up names or room labels.

The downloaded file includes:

  • The correct headers in the right order
  • Example rows using your company's real staff emails, names, and room names
  • Future dates (next week's Monday onwards)
tip

Open the template in Excel or Google Sheets, replace the example rows with your shift data, and save as .csv before uploading.

Example CSV

date,start_time,end_time,staff_email,staff_name,room_name,shift_type,notes
18/03/2026,08:30,17:00,dr.smith@practice.com,Dr Sarah Smith,Surgery 1,regular,Morning surgery
18/03/2026,09:00,13:00,nurse.jones@practice.com,Nurse Amy Jones,Treatment Room,regular,Morning clinic
19/03/2026,18:00,08:00,dr.smith@practice.com,Dr Sarah Smith,,on_call,Overnight on-call

Key points:

  • UK date format (DD/MM/YYYY) is fully supported
  • Overnight shifts (18:00–08:00) are auto-detected — the system adds 1 day to the end time
  • Room name left empty for on-call (room will be unassigned)
  • Staff can be identified by email or name (email takes priority)

Step-by-Step Import

  1. Download Template — click "Download CSV Template" to get the file pre-populated with your company data
  2. Fill in your data — open in a spreadsheet, add your shifts, save as .csv
  3. Upload — click the upload area or drag-and-drop your file
  4. Review the preview — the system parses your CSV immediately and shows:
    • Green checkmark = valid shifts parsed
    • Red errors = rows with invalid dates, times, or missing columns (rejected)
    • Yellow warnings = unresolved staff/rooms, unknown shift types (may still import)
    • Preview table showing the first 5 parsed shifts
  5. Configure options:
    • Skip rows with unresolved staff — silently skip rows where the staff member can't be found
    • Skip conflicting shifts — skip shifts that overlap with existing ones
  6. Click "Import Shifts"
  7. Review results — shows created, skipped, and failed counts with error details

Common Errors

ErrorCauseFix
Missing required columns: dateWrong header namesUse exactly date, start_time, end_time
Invalid date formatNon-standard date (e.g., "March 18")Use 18/03/2026 or 2026-03-18
Invalid start time format12-hour format (e.g., "9am")Use 09:00 (24-hour)
Could not resolve staff memberEmail/name doesn't match active staffCheck the email or use First Last format
Skipped due to scheduling conflictStaff already has a shift at that timeEnable "Skip conflicts" or change the time

CSV Export

What It Does

Exports shifts within a date range to a CSV file. The exported file includes staff names, emails, and room names (not just IDs).

How to Use

  1. Open the Export function from the calendar view
  2. Select a date range (maximum 90 days)
  3. Optionally filter by specific staff or rooms
  4. Click Export

Exported Columns

ColumnFormatExample
DateDD/MM/YYYY18/03/2026
DayFull nameWednesday
Staff NameFirst LastDr Sarah Smith
Staff EmailEmaildr.smith@practice.com
RoomRoom nameSurgery 1
Start TimeHH:mm08:30
End TimeHH:mm17:00
Shift TypeLowercaseregular
StatusLowercasescheduled
NotesFree textMorning surgery

All times are displayed in UK timezone (Europe/London).

Re-Importing an Exported CSV

The export format cannot be directly re-imported because the column headers differ. To re-import, rename the headers:

Export HeaderChange To
Datedate
Start Timestart_time
End Timeend_time
Staff Emailstaff_email
Staff Namestaff_name
Roomroom_name
Shift Typeshift_type
Notesnotes

Delete the Day and Status columns before importing.


Bulk Edit

What It Does

Updates properties of multiple selected shifts at once. You can change the room, shift type, status, and/or adjust times.

How to Access

  1. In the calendar, enter selection mode (click "Select Multiple")
  2. Click on the shifts you want to edit (they highlight with a coral border)
  3. Click the "Bulk Edit" button that appears
  4. The Bulk Edit modal opens showing how many shifts are selected

Available Operations

Each operation is opt-in — tick the checkbox to enable it:

Change Room

  • Select a new room from the dropdown
  • Can also set to "No Room"

Change Shift Type

  • Select from: Regular, Overtime, On Call, Emergency, Training, Meeting, Break

Change Status

  • Select from: Scheduled, Confirmed, Cancelled
note

Only 3 statuses are available in bulk edit. To mark shifts as Completed, In Progress, or No Show, edit them individually.

Adjust Time

FieldDescriptionExample
Start Time Offset (mins)Positive = later, negative = earlier+30 moves start 30 min later
End Time Offset (mins)Positive = later, negative = earlier-60 ends shift 1 hour earlier

Common patterns:

  • Move entire shift 30 min later: Start +30, End +30
  • Shorten shift by 1 hour at the end: Start 0, End -60
  • Start 15 min earlier: Start -15, End 0
warning

Time adjustment shifts each individual shift by the offset — it does not set all shifts to the same time.

Limits

  • Maximum 100 shifts per bulk update
  • All selected shifts must belong to the same company
  • At least one edit option must be enabled

Keyboard Shortcuts

ShortcutActionCondition
EscapeClose the modalNot currently processing
EnterSubmit the current actionFocus not in an input field

Best Practices

Template Mode

  1. Start small — test with a single week before creating months of shifts
  2. Check leave first — review approved leave in the target date range
  3. Select the correct room — shifts cannot be created without a room assignment

Copy Week

  1. Review the source week — ensure it represents the pattern you want
  2. Use filters — copy only relevant staff or rooms to reduce conflicts
  3. Check "Skip conflicts" if the target week already has some shifts

CSV Import

  1. Always download the template first — it's pre-populated with your company's rooms and staff
  2. Use UK date formatDD/MM/YYYY works naturally
  3. Test with a small file — import 3–5 rows first to verify formatting
  4. Enable both skip options — "Skip unresolved staff" and "Skip conflicts" prevent partial failures

Bulk Edit

  1. Double-check your selection — review the count shown in the modal header
  2. Use time adjustment carefully — it applies to every selected shift
  3. Exit selection mode when done to avoid accidental selections

Troubleshooting

IssueCauseSolution
No shifts createdAll shifts conflicted with existing onesEnable "Skip conflicts" and review which days are already filled
Template shows 0 shifts in previewNo matching days in the date rangeCheck the day selection (Mon–Fri vs specific days)
CSV import rejects all rowsWrong column headersDownload the template and use it as a base
Staff not found during importEmail doesn't match or staff is deactivatedVerify the email in Staff Management
Room not found during importRoom name doesn't match exactlyCheck room names in Settings → Rooms
Export is emptyNo shifts in the selected date rangeExpand the date range or remove filters
Bulk edit failsShifts belong to different companiesOnly select shifts within your company


Source Files:

  • src/components/calendar/BulkSchedulingTool.tsx — Bulk scheduling modal (Template, Copy Week, Import)
  • src/components/calendar/BulkEditModal.tsx — Bulk edit modal
  • src/lib/utils/csv-parser.ts — CSV parsing and template generation
  • src/app/api/scheduling/shifts/import/route.ts — CSV import API
  • src/app/api/scheduling/shifts/export/route.ts — CSV export API
  • src/app/api/scheduling/shifts/copy-week/route.ts — Copy week API
  • src/app/api/scheduling/shifts/bulk-update/route.ts — Bulk update API