CData Python Connector for Xero

Build 25.0.9454

UploadFile

Used to upload a file to Xero's file storage service. It allows for attaching documents such as invoices, receipts, and contracts to records in Xero.

Procedure-Specific Information

There are a few different ways to upload a file:

1. Provide the full path to a local file. This will create a file with the same name and content in Xero:

EXECUTE UploadFile @Filename = 'c:/my/xero/files/form.docx

2. Provide the full path to a local file as well as a Name. This will still upload the content in the file, but lets you change the name of the file in Xero:

EXECUTE UploadFile @Filename = 'c:/my/xero/files/form.docx', @Name = 'legal-form.docx'

3. Provide the file's content in base64 and the name the file should receive in Xero:

EXECUTE UploadFile @Name = hello.txt', @FileData = 'SGVsbG8sIFdvcmxkIQo=' 

In addition, you can provide a ContentType to override what type Xero should use when classifying the file. Please note however that Xero only supports a limited number of MIME types, which are listed in the Xero Central article on managing the file library.

Input

Name Type Required Description
Name String False The name that will be assigned to the file when uploaded. If not provided, it will be automatically derived from the Filename.
ContentType String False The MIME type for the document. If not explicitly provided, this will be automatically detected based on the file's content.
FileData String False Base64-encoded data of the file. This is required if neither Filename nor FileStream is provided.
Filename String False The full file path (including filename) to be uploaded. This is required if neither FileData nor FileStream is provided.
TenantId String False The unique identifier for the tenant to be queried, overriding the connection's default tenant.

Result Set Columns

Name Type Description
Success String A boolean indicating whether the file upload operation was successful.
FileId String The unique Xero-generated identifier for the uploaded file.
Name String The name assigned to the uploaded file.
FolderId String The unique identifier of the folder where the file was uploaded.
MimeType String The MIME type of the uploaded file, indicating the file's data type.
Size Int The size of the uploaded file in bytes.
User_Id String The unique identifier of the user who uploaded the file.
User_Name String The username of the user who uploaded the file.
User_FirstName String The first name of the user who uploaded the file.
User_LastName String The last name of the user who uploaded the file.
User_FullName String The full name of the user who uploaded the file.
Created Datetime The timestamp when the file was first uploaded.
Updated Datetime The timestamp when the file metadata was last updated.

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