docs.sheetjs.com/docz/docs/02-getting-started/03-roadmap.md

86 lines
3.1 KiB
Markdown
Raw Normal View History

2022-05-16 03:26:04 +00:00
---
2022-08-13 22:01:26 +00:00
sidebar_position: 3
2022-05-16 03:26:04 +00:00
---
# Roadmap
Most scenarios involving spreadsheets and data can be divided into 5 parts:
1) **Acquire Data**: Data may be stored anywhere: local or remote files,
databases, HTML TABLE, or even generated programmatically in the web browser.
2) **Extract Data**: For spreadsheet files, this involves parsing raw bytes to
read the cell data. For general JS data, this involves reshaping the data.
3) **Process Data**: From generating summary statistics to cleaning data
records, this step is the heart of the problem.
4) **Package Data**: This can involve making a new spreadsheet or serializing
with `JSON.stringify` or writing XML or simply flattening data for UI tools.
5) **Release Data**: Spreadsheet files can be uploaded to a server or written
locally. Data can be presented to users in an HTML TABLE or data grid.
A common problem involves generating a valid spreadsheet export from data stored
2023-06-20 01:21:34 +00:00
in an HTML table.
```mermaid
flowchart LR
server[(Backend\nServer)]
html{{HTML\nTABLE}}
wb(((SheetJS\nWorkbook)))
wb2(((Modified\nWorkbook)))
file[(workbook\nfile)]
server --> |"Get Table (1)\n."| html
html --> |"Parse Table (2)\n`table_to_book`"| wb
wb --> |"Add data (3)\n`sheet_add_aoa`"| wb2
wb2 --> |"Export file (4,5)\n`writeFile`"| file
```
In this example, an HTML TABLE on the page will be scraped, a row will be added
to the bottom with the date of the report, and a new file will be generated and
downloaded locally. `XLSX.writeFile` takes care of packaging the data and
attempting a local download:
2022-05-16 03:26:04 +00:00
```js
// Acquire Data (reference to the HTML table)
var table_elt = document.getElementById("my-table-id");
// Extract Data (create a workbook object from the table)
var workbook = XLSX.utils.table_to_book(table_elt);
// Process Data (add a new row)
var ws = workbook.Sheets["Sheet1"];
XLSX.utils.sheet_add_aoa(ws, [["Created "+new Date().toISOString()]], {origin:-1});
// Package and Release Data (`writeFile` tries to write and save an XLSB file)
XLSX.writeFile(workbook, "Report.xlsb");
```
This library tries to simplify steps 2 and 4 with functions to extract useful
data from spreadsheet files (`read` / `readFile`) and generate new spreadsheet
files from data (`write` / `writeFile`). Additional utility functions like
`table_to_book` work with other common data sources like HTML tables.
This documentation and various demo projects cover a number of common scenarios
and approaches for steps 1 and 5.
Utility functions help with step 3.
## Highlights
2023-06-20 01:21:34 +00:00
["Demos"](/docs/demos) describes special deployments using SheetJS in tandem with
other tools and libraries.
2022-10-30 05:45:37 +00:00
["Data Import"](/docs/solutions/input) describes solutions for common data import
2022-05-16 03:26:04 +00:00
scenarios.
2022-10-30 05:45:37 +00:00
["Data Export"](/docs/solutions/output) describes solutions for common data export
2022-05-16 03:26:04 +00:00
scenarios.
2022-10-30 05:45:37 +00:00
["Data Processing"](/docs/solutions/processing) describes solutions for common
2022-05-16 03:26:04 +00:00
workbook processing and manipulation scenarios.
2022-10-30 05:45:37 +00:00
["Utility Functions"](/docs/api/utilities) details utility functions for
2022-05-16 03:26:04 +00:00
translating JSON Arrays and other common JS structures into worksheet objects.