Answer the question
In order to leave comments, you need to log in
How to parse from xlsx to js objects?
Hello friends, there is a table in the form of XLSX, 6 columns and many rows.
Model, year, engine, link, cost of repair, cost of parts
Need to be brought into the form:
models: [{
model: 'модель',
years: [{
year: 'год',
engines: [
{ engine: 'движок', image: 'ссылка', work: 'стоимость работ', parts: 'стоимость деталей' },
]
}, {
model: 'модель',
years: [{
year: 'год',
engines: [
{ engine: 'движок', image: 'ссылка', work: 'стоимость работ', parts: 'стоимость деталей' },
]
}]
}]
Answer the question
In order to leave comments, you need to log in
In CSV and process line by line. You can just do it in Notepad++))
UPD#1:
1. Open the CSV file in Sublime Text
2. Press Ctrl+H
3. Paste this regular expression into the top field:
([^;]*)?;([^;]*)?;([^;]*)?;([^;]*)?;([^;]*)?;([^;\r\n]*)?\n*
\{\n\tmodel: '$1',\n\tyears: \[\{\n\t\tyear: '$2',\n\t\tengines: \[\n\t\t\t\{ engine: '$3', image: '$4', work: '$5', parts: '$6' \}\n\t\t\]\n\},\n
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question