Unlike other systems that require you download a sample file for recipients,
Simpu provides a more streamlined approach by allowing you to upload your own
files and allows you map columns to the recipient fields directly.
useSimpuFileUpload
TheuseSimpuFileUpload
hook handles recipient file uploads, including CSV and Excel file processing for campaign recipients.
Usage
Return Values
onUploadFile(fileType: "csv" | "excel", file: File)
- Uploads a file and returns import data and columnsonUploadBlob(blob: Blob)
- Uploads a blob as a fileonProcessCSVFile(file: File)
- Processes CSV file and returns sample data (up to 500 rows of the file) for use when auto-detecting columnsonProcessExcelFile(file: File)
- Processes Excel file and returns sample data (up to 500 rows of the file) for use when auto-detecting columnsonFileUploadDropRejected({ files: File[] })
- Handles rejected file uploads, such as unsupported file types or size limits
useImportMapping
TheuseImportMapping
hook manages column mapping for imported files, including auto-detection of column types and manual mapping configuration.
Usage
Parameters
Return Values
State
mappedProperties: PropertySchema[]
- Array of mapped propertiesautoDetectionLoading: boolean
- True when auto-detecting column typeshasSelectedEmailColumn: boolean
- True if an email column is selected
Methods
onMapColumns(importId: string, mapping: Record<string, PropertySchema>)
- Maps columns for importonPropertyUpdate(property: PropertySchema, index: number)
- Updates a propertyonAutoDetectColumns(dataSample?: any[])
- Auto-detects column types from sample data