Parser Can Only Read First Column
Hello Team,
I am having an issue where the tool only seems the parse the first column properly. I have a spreadsheet that looks like the following:
| Id | Company GUID | Parent Company GUID | Site GUID | Site Owner | Site Number | Site Name | Site Address | City | State | Delegated | TMW Site ID | TMW Bill To ID |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 00416b56-1060-4687-aff8-b0ef62f3280a | 29f9ab06-7c18-45d2-a4c9-f2a2869453d3 | 8338dc15-d96d-4a84-8a3d-9423840e030e | 00416b56-1060-4687-aff8-b0ef62f3280a | REDACTED | REDACTED | REDACTED | REDACTED | HOUSTON | Texas | Yes | ||
| 005aa93c-2e48-4aa0-a774-8f06ef95f63f | 29f9ab06-7c18-45d2-a4c9-f2a2869453d3 | c7c07445-c075-4b12-be81-65e9e00b6a67 | 005aa93c-2e48-4aa0-a774-8f06ef95f63f | REDACTED | REDACTED | REDACTED | REDACTED | MONROE | Louisiana | Yes | 2707777 | CIRTEM |
I've tried both schema and map, and I get the same results. This is my schema:
const schema = {
Id: {
prop: 'ID',
type: String,
required: true,
},
'Company GUID': {
prop: 'companyGUID',
type: String,
required: true,
},
'Parent Company GUID': {
prop: 'parentCompanyGUID',
type: String,
required: true,
},
'Site GUID': {
prop: 'siteGUID',
type: String,
required: true,
},
'Site Owner': {
prop: 'siteOwner',
type: String,
required: true,
},
'Site Number': {
prop: 'siteNumber',
type: String,
required: true,
},
'Site Name': {
prop: 'siteName',
type: String,
required: true,
},
'Site Address': {
prop: 'siteAddress',
type: String,
required: true,
},
City: {
prop: 'siteCity',
type: String,
required: true,
},
State: {
prop: 'siteState',
type: String,
required: true,
},
Delegated: {
prop: 'delegated',
type: String,
required: true,
},
'TMW Site ID': {
prop: 'tmwSiteID',
type: String,
required: false,
},
'TMW Bill To ID': {
prop: 'tmwBillToID',
type: String,
required: false,
},
};
This is the map I tried:
const map = {
ID: 'Id',
'Company GUID': 'companyGUID',
'Parent Company GUID': 'parentCompanyGUID',
'Site GUID': 'siteGUID',
'Site Owner': 'siteOwner',
'Site Number': 'siteNumber',
'Site Name': 'siteName',
'Site Address': 'siteAddress',
City: 'siteCity',
State: 'siteState',
Delegated: 'delegated',
'TMW Site ID': 'tmwSiteID',
'TMW Bill To ID': 'tmwBillToID',
};
Here is the function:
readXlsxFile(file, { map }).then(({ rows, errors }) => {
// `rows` is an array of rows
// each row being an array of cells.
logger.debug(util.inspect(rows), errors);
// console.log(rows, errors);
});
It spits out the ID's from the first column, but the remaining columns are errors:
{ ID: '107e870f-b863-4652-a2b5-bfb8886bc12f' },
{ ID: '10be18b4-e466-46b3-9804-ff53379c8b62' },
{ ID: '10c54014-dd76-41a8-ab27-c2742d1507b3' },
{ ID: '1114c790-5041-497b-a534-657c9917a137' },
{ ID: '1123893e-c8df-41c7-ac8d-fa05a4aaec51' },
{ ID: '1138c682-1892-43a9-a359-b119bc96784e' },
... 1367 more items
] {
"0": {
"error": "required",
"row": 2,
"column": "Company GUID"
},
"1": {
"error": "required",
"row": 2,
"column": "Parent Company GUID"
},
"2": {
"error": "required",
"row": 2,
"column": "Site GUID"
},
I'm doing this in the exact same fashion as the tutorial. What am I missing? I am using version 5.8.3.
Thank you!