Import CSV
Launch the import CSV popup for a dataform
Launches the import CSV popup, where you can upload CSV file and map its columns to the corresponding fields.
Parameters
| Parameters | Type | Description |
|---|---|---|
| defaultValues | Object | An object with keys as field Id and its values in respective data types. |
Syntax
let defaultValues = { fieldId: "value" };
dataformInstance.importCSV(defaultValues);Example
Consider a scenario where certain fields are not visible to the user (hidden in form visibility). In that case, default values can be used to populate data in these hidden fields.
// Get the dataform with the dataform's flow_id
const dfInstance = kf.app.getDataform("Product_Dataform_A00"); // Product_Dataform_A00 is the flow_id.
// Set field values for specific fields of the dataform
let defaultValues = { location: "India" }; // Location is the field_id of a field inside the dataform.
// Pass the field config into the import sdk method
dfInstance.importCSV(defaultValues); // All records imported through this importer would have the Location field set as India.Note
Note
- Default values here is optional.
- Any variables or parameter can also be mapped in
defaultValues. - If a default value is set by the developer, end users cannot override it.
- Certain fields cannot be set as default, such as auto-calculated fields and sequence numbers.

