Payroll export
An export writes a pay period’s timecards to a file for another system. That is usually your payroll system’s import. An export never includes time that’s about to change. Each export remembers what it wrote. So you can see whose time changed after the file went to payroll.
The file’s format comes from an exporter. A CSV exporter comes ready to use. An exporter for any other format can be written for you.
hourctl -t acme attend export run standard/csv 2026-10-05 --only closed --employer acme-ca \ --param id_attribute=payroll_id -o october-1.csvChoosing what goes in
Section titled “Choosing what goes in”An export covers one pay period, named by its first day. You choose which timecards it includes:
| Include | Timecards |
|---|---|
| All (the default) | Everyone’s, as they stand. |
| Closed | Only those in a closed period: what payroll pays. |
| Approved | Only those approved at every stage, as a whole or for every assignment. |
An export covers pay unless you ask for the bill side.
One employer at a time
Section titled “One employer at a time”An export writes the people of one
employer. That is the one
you name (--employer acme-ca), or the tenant’s only employer when it
has just one.
A tenant with several employers must name one. It can name * instead,
for every employer’s people and the unlinked people’s. If you name none,
the export is refused and lists the employers. The export records whose
people it wrote.
The file
Section titled “The file”The file streams to you as it’s written, so even a large export starts at once. The file itself isn’t kept. If the exporter fails partway, the export is marked failed and the file is cut short. So a half-written file is never mistaken for a whole one.
Never time that’s about to change
Section titled “Never time that’s about to change”An export doesn’t run while anyone’s time up to the end of that period is still being worked out again. For example, this is so right after a late punch or a policy change.
The export says who it’s waiting for. That includes anyone whose timecard can’t be worked out because of a setup problem. Nothing half-finished reaches payroll.
The ready-made CSV
Section titled “The ready-made CSV”The standard/csv exporter writes one row per person, day and pay
category. The row has the person, the period’s first and last day, the
day, the category, and the hours. It writes paid time only. A category
that is not paid (a meal deducted, say) has no row. Its settings:
| Setting | What it does |
|---|---|
id_attribute | Names each person by a detail of their employment, such as payroll_id, instead of their id in Hour Advantage. If someone has no such detail, the export stops and says who. It does not make one up. |
codes | Writes each category as your payroll system’s earning code, such as { work = "REG", overtime = "OT" }. A category it does not name is written under the code your setup gives it. If it has no code either, the export stops. It does not send the hours under a guessed code. Without codes, each category is written under the setup’s code, or its own name. |
include_unpaid | true writes the categories that are not paid too. |
by | "period" writes one row per person and category for the whole period instead of one per day. |
See the csv standard rule and
the cookbook’s payroll export
recipe.
Keeping track
Section titled “Keeping track”Every export is kept on record. The record holds:
- who ran it, and when;
- which exporter was used, and for which period;
- what it included;
- whether it finished, and why not if it failed;
- how many people it covered.
A download stopped before the end is recorded as failed. For each person, the export also remembers exactly which timecard went into the file.
So an export can show whose time has changed since it ran, among the people it covered. If a supervisor corrects a punch after the file went to payroll, you know exactly who needs a follow-up.
hourctl -t acme attend export listhourctl -t acme attend export show 6f1c2e0a-5b7d-4c3e-9a8f-0d1e2f3a4b5cThe attendance API has the routes for running and reading exports.
Other formats
Section titled “Other formats”An exporter for your payroll system’s own format is part of your policy package. It’s given each person’s timecard in turn. The timecard has hours by category and by day, each line, counts and money, and their employment details. The exporter writes that person’s rows, with an optional header and a closing part that sees the totals. What it writes for one person can’t depend on anyone else.
Each line it’s given says whether it’s approved, by its period or its assignment. It also gives the rates its work is at: the pay rate, and a client’s bill rate.
So an invoice can bill one client’s approved hours while another’s wait. An invoice can also price a client’s hours at each bill rate once for the period rather than line by line. The cookbook’s staffing agency recipe does both.
Developers: see exporters in the policy step reference.