CData Python Connector for Xero

Build 25.0.9454

Timesheets

Used to query, insert, and update timesheets for a Xero organization. Timesheets record the hours worked by employees, which are used to calculate pay for hourly workers.

Table Specific Information

The Timesheets table allows you to SELECT, INSERT and UPDATE timesheet lines for a Xero organization. The Id column is generated by the connector; the value of this field combines the index of the line item with the unique, Xero-generated TimesheetID.

SELECT

The Xero API allows extensive filtering and ordering. You can define WHERE and ORDER BY clauses in a query to filter and order the results using any non-line-item column.

Note: The Xero API does not support filtering on line items or journal lines.

INSERT

To insert a single row, set the required fields. A new table object is created as a single entry. To insert a new timesheet, the EmployeeID, StartDate and EndDate fields are required.

In addition to inserting a single row, line item tables offer two additional ways to insert into a table.

  1. You can insert a new object with multiple line items using XML aggregates. The elements supported here are the same as the Line columns with the Line_ prefix removed, except when providing numbers of units. See the Xero documentation for the Timesheets API endpoint for more details.
    INSERT INTO Timesheets (EmployeeID, StartDate, EndDate, TimesheetLineAggregate) VALUES (
      'XXXXX-XXXXX-XXXXX-XXXXX',
      '2021-01-01',
      '2021-01-07',
      '<TimesheetLine>
    	<EarningsRateID>YYYYY-YYYYY-YYYYY-YYYYY</EarningsRateID>
    	<NumberOfUnits>
    	 <NumberOfUnit>8</NumberOfUnit>
    	 <NumberOfUnit>7</NumberOfUnit>
    	 <NumberOfUnit>8</NumberOfUnit>
    	 <NumberOfUnit>6</NumberOfUnit>
    	 <NumberOfUnit>9</NumberOfUnit>
       </TimesheetLine>
       <TimesheetLine>
        <EarningsRateID>ZZZZZ-ZZZZZ-ZZZZZ-ZZZZZ</EarningsRateID>
    	...
       </TimesheetLine>'
    )
  2. You can insert a new line item on an existing object by specifying the Xero-generated identifier of the existing record. For example, to add a line item to an existing timesheet:
    INSERT INTO Timesheets (TimesheetID, Line_EarningsRateID, Line_NumberOfUnits_NumberOfUnit1, Line_NumberOfUnits_NumberOfUnit2, ...) VALUES ('XXXXX-XXXXX-XXXXX-XXXXX', 'YYYYY-YYYYY-YYYYY-YYYYY', 8, 7, ...)

Note: Inserting into existing records will count as two operations against the Xero API. One is required to retrieve the existing record, and another to update the record with new data.

UPDATE

You can update any field that is not read-only.

Note: UPDATE operations will count as two operations against the Xero API. One is required to retrieve the existing record, and another to update the record with new data.

DELETE

The Xero API has limited support for deleting any object. In order to delete objects, you must update their Status to an appropriate value.

Applicable values for this field may be state-dependent. For example, invoices can only have their status set to DELETED when the invoice status is currently DRAFT or SUBMITTED.

Columns

Name Type ReadOnly Filterable Description
Id [KEY] String True

A unique identifier for the timesheet line-item, combined with the unique Xero identifier of the timesheet, used to reference each specific line within a timesheet.

TimesheetID String True

The unique identifier for the overall timesheet to which this line item belongs, assigned by Xero when the timesheet is created.

EmployeeID String False

The unique identifier of the employee associated with the timesheet line. This ID links the timesheet entry to a specific employee.

StartDate Date False

The start date for the timesheet period, indicating when the work period began.

EndDate Date False

The end date for the timesheet period, indicating when the work period concluded.

Status String False

The status of the timesheet, with valid values being 'DRAFT' (timesheet is not finalized), 'PROCESSED' (timesheet has been processed), and 'APPROVED' (timesheet is approved for payroll).

Hours Double False

The total number of hours worked by the employee for this timesheet line, indicating the amount of time recorded during the period.

Line_EarningsRateId String False

The unique Xero identifier for the earnings type associated with the timesheet line, which links the line to a specific earnings rate such as hourly or salary.

Line_TrackingItemId String False

The unique Xero identifier for a tracking category and option used in the timesheet, linking this timesheet entry to a specific tracking item (for example, department or project).

Line_WorkLocationId String False

The unique Xero identifier for the work location related to the timesheet line, which specifies where the work was performed.

Line_NumberOfUnits_NumberOfUnit1 String False

The number of units worked in the first unit of time for the timesheet line (for example, hours or shifts).

Line_NumberOfUnits_NumberOfUnit2 String False

The number of units worked in the second unit of time for the timesheet line (for example, hours or shifts).

Line_NumberOfUnits_NumberOfUnit3 String False

The number of units worked in the third unit of time for the timesheet line (for example, hours or shifts).

Line_NumberOfUnits_NumberOfUnit4 String False

The number of units worked in the fourth unit of time for the timesheet line (for example, hours or shifts).

Line_NumberOfUnits_NumberOfUnit5 String False

The number of units worked in the fifth unit of time for the timesheet line (for example, hours or shifts).

Line_NumberOfUnits_NumberOfUnit6 String False

The number of units worked in the sixth unit of time for the timesheet line (for example, hours or shifts).

Line_NumberOfUnits_NumberOfUnit7 String False

The number of units worked in the seventh unit of time for the timesheet line (for example, hours or shifts).

Line_UpdatedDateUTC Datetime True

The timestamp indicating when the timesheet line was last updated, useful for tracking modifications to the timesheet data.

TimesheetLineAggregate String False

A parameter used to define the timesheet line items as aggregated XML values, typically provided when inserting new records into the system.

TenantId String False

The unique identifier for the tenant to query instead of the connection tenant, used to specify the tenant in multi-tenant setups.

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 25.0.9454