jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.66k stars 820 forks source link

Nodejs support #1643

Closed Ily1606 closed 3 months ago

Ily1606 commented 10 months ago

How to parse spreadsheet and get data on nodejs

Example: Input

{
"data": [
        {
            "id": 33,
            "record_date": "2023-09-01",
            "value": 0,
            "value_set": 0.2,
            "month_ago": 1,
            "final_rate": "=SUM(C1,D1)",
            "extendProps": {
                "id": 33,
                "record_date": "2023-09-01"
            }
        }
    ],
"columns": [
        {
            "name": "month_ago",
            "type": "text",
            "width": "100px"
        },
        {
            "name": "record_date",
            "width": "100px",
            "type": "text"
        },
        {
            "name": "value",
            "type": "number",
            "locale": "ja-JP",
            "mask": "0.00%;[Red]-(0.00%)",
            "width": "100px"
        },
        {
            "name": "value_set",
            "type": "number",
            "locale": "ja-JP",
            "mask": "0.00%;[Red]-(0.00%)",
            "width": "100px",
            "inputmode": "decimal"
        },
        {
            "name": "final_rate",
            "type": "number",
            "locale": "ja-JP",
            "mask": "0.00%;[Red]-(0.00%)",
            "width": "100px",
            "inputmode": "decimal",
            "readOnly": true
        },
        {
            "title": " ",
            "name": "id",
            "readOnly": true,
            "visible": false,
            "type": "text",
            "width": "100px"
        },
        {
            "name": "extendProps",
            "readOnly": true,
            "visible": false,
            "type": "text",
            "width": "100px"
        }
    ],
}

Output

{
"data": [
        {
            "id": 33,
            "record_date": "2023-09-01",
            "value": 0,
            "value_set": 0.2,
            "month_ago": 1,
            "final_rate": "=20",
            "extendProps": {
                "id": 33,
                "record_date": "2023-09-01"
            }
        }
    ],
}
hodeware commented 3 months ago

Jspreadsheet CE has no support to run on NodeJS. You might try jsdom, but you might encounter several limitations.