forked from sheetjs/docs.sheetjs.com
828 B
828 B
title | pagination_prev | pagination_next | sidebar_custom_props | ||
---|---|---|---|---|---|
IndexedDB API | demos/grid | demos/worker |
|
:::warning
IndexedDB is a very low-level API. It is strongly recommended to use a wrapper library or WebSQL in production applications.
:::
localForage
is a IndexedDB wrapper that presents an async Storage interface.
Arrays of objects can be stored using JSON.stringify
using row index as key:
const aoo = XLSX.utils.sheet_to_json(ws);
for(var i = 0; i < aoo.length; ++i) await localForage.setItem(i, JSON.stringify(aoo[i]));
Recovering the array of objects is possible by using JSON.parse
:
const aoo = [];
for(var i = 0; i < localForage.length; ++i) aoo.push(JSON.parse(await localForage.getItem(i)));
const wb = XLSX.utils.json_to_sheet(aoo);