Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EXCEL_FILENAME=somefile.xlsx
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
node_modules/
.xls
.xlsx
.csv
.zip
.env
.vscode
*.xls
*.xlsx
*.csv
*.zip
*.json
*.env
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,84 @@ The following requirements were used for this project. Feel free to use other de
- node v16.14.2
- npm v8.5.0

## Notes

- The bullet list symbols: `●`, `•` and a dash `-` can be used interchangeably per main item group (same for a single cell, but can differ across rows and columns).
- Expect the excel bullet text to be riddled with special characters (newlines, tabs and others).
- The script should be able to handle and convert mixed cases of unconventional and regular bullet-list formatting in all excel cells to HTML tags.The bullet list (per excel cell) can contain formats:

### Messy Format 1

Sub item is in the same line as the main ordered item.

```
1. main item 1 ● sub item 1
● sub item 2
● sub item 3

2. main item 2
● sub item 1
● sub item 2
● sub item 3
```

### Messy Format 2

Sub item is in the same line as the unordered main item.

```
● main item 1 ● main item 2
● main item 3
● main item 4
```

### Messy Format 3 (Uses a dash symbol)

Sub item is in the same line as the unordered main item.

```
● main item 1
- sub item 1
- sub item 2
- sub item 3
● main item 2
- sub item 1
- sub item 2
● main item 3
● main item 4
```

### Conventional Format 1 (Number and bullets)

```
1. main item 1
● sub item 1
● sub item 2
● sub item 3
```

### Conventional Format 2 (All bullets)

```
● main item 1
● main item 2
● main item 3
```

### Conventional Format 3 (Number and bullets, starts with a bullet)

```
● main item
1. sub item 2
2. sub item 3

● main item 2
1. sub item 1
2. sub item 2
3. sub item 3
```


## Installation

1. Clone this repository.<br>
Expand All @@ -22,6 +100,11 @@ The following requirements were used for this project. Feel free to use other de
2. Install dependencies.<br>
`npm install`

3. Create a `.env` file from the `.env.example` file. Replace `EXCEL_FILENAME` with a target excel file's filename relative to the `/src/01_recommendations` directory.

4. See the excel parser script's example usage on<br>
`/src/01_recommendations/index.js`

## Available scripts

### `npm run lint`
Expand All @@ -32,5 +115,11 @@ Check source codes for lint errors.

Fix lint errors.

### `npm run parse`

Normalize an unconventional, complex excel file into an array of simple JS objects with columns containing messy (ordered and unordered) bullet lists converted into organized HTML list tags.

> **WARNING:** The script does not support `-` (dash) symbols.

@ciatph<br>
20221205
Loading