Skip to main content

Result of the nuvo importer

General

After a successful file import, the data is provided as an array object (result) containing a JSON object for each submitted row. In the following, you can see an example output of a file import with three rows:

[
{
"customer_code": "2345678954",
"customer_name": "Nuvo GmbH",
"domain_name": "getnuvo.com",
"address": "Schoeneberger Allee 6",
"region": "Hamburg, Germany",
"deal_size": 10000,
"deal_stage": "Follow Up",
"pipeline": "Pipeline Nr.1",
"deal_ongoing": true
},
{
"customer_code": "2345678955",
"customer_name": "ComDocks Ltd.",
"domain_name": "www.comdocks.com",
"address": "Suedring 28",
"region": "Berlin, Germany",
"deal_size": 25000,
"deal_stage": "Lead",
"pipeline": "Pipeline Nr.2"
"deal_ongoing": false
},
{
"customer_code": "2345678956",
"customer_name": "Nuvo GmbH",
"domain_name": "getnuvo.com",
"address": "Garden Street 12",
"region": "New York, US",
"deal_size": 30000,
"deal_stage": "Follow Up",
"pipeline": "Pipeline Nr.1"
"deal_ongoing": true
}
]

The keys of each JSON object are the keys you defined in your target data model. The values come from the matched columns of the file that was uploaded. Notice that the output values can either be a String, an Integer, a Float or a Boolean. This depends on how you have defined columnType of each target data model column.

You can access the user-submitted data as an array of JSON objects with the result parameter within onResults. With this callback function you can process, transform and/or sent the returned data to your preferred API endpoint.

info

Within the onResults function, you have a lot of possibilities at your disposal. For instance, you can do external server calls, define variables, modify the structure and the values of each object, or call a function that leads to an XLSX- or CSV-Download.

Examples

Displaying the result in the console

<NuvoImporter
licenseKey="Your License Key"
settings={{
developerMode: true,
identifier: "product_data",
columns: [
{
label: "Product ID",
key: "product_id",
},
{
label: "Article Name",
key: "article_name",
},
],
}}
onResults={(result, identifier) => {
console.log("Result: ", result);
console.log("Identifier: ", identifier);
}}
>
Select File
</NuvoImporter>

Sending the result to an API endpoint

<NuvoImporter
licenseKey="Your License Key"
settings={{
developerMode: true,
identifier: "product_data",
columns: [
{
label: "Product ID",
key: "product_id",
},
{
label: "Article Name",
key: "article_name",
},
],
}}
onResults={(result, identifier) => {
fetch('https://my-json-server.typicode.com/getnuvo/nuvo/customers', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
data: {
result
identifier
},
}),
})
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
}}
>
Select File
</NuvoImporter>

Transforming the result structure

<NuvoImporter
licenseKey="Your License Key"
settings={{
developerMode: true,
identifier: "product_data",
columns: [
{
label: "Product ID",
key: "product_id",
},
{
label: "Article Name",
key: "article_name",
},
{
label: "Street",
key: "street",
},
{
label: "Postal Code",
key: "postal_code",
},
{
label: "City",
key: "city",
},
]
}}
onResults={(result, identifier) => {
const targetOutput = result.map(item => {
return {
product_id: item?.product_id ?? "default value id",
article_name: item?.article_name ?? "default value article name",
production_address: {
street: item?.street ?? "default value street",
postal_code: item?.postal_code ?? "default value code",
city: item?.city ?? "default value city",
},
};
});

console.log("Result: ", result);
console.log("Identifier: ", identifier);
console.log("Target output: ", targetOutput);
}}
>
Select File
</NuvoImporter>