convertJson()
function convertJson(
templateBuffer,
sourceJson,
options?): Promise<OutputFile[]>;
Defined in: impl/js/src/index.ts:399
Run full conversion from a JSON source (ADR-0075) instead of a
data.xlsx. Accepts the xl3-source-json/0.1 wire format as a JSON
string, raw bytes (ArrayBuffer/Uint8Array), or an already-parsed
object. Renders the same workbook convert() produces from the
equivalent data.xlsx.
Parameters
| Parameter | Type |
|---|---|
templateBuffer | ArrayBuffer |
sourceJson | Xl3SourceJsonInput |
options? | ConvertOptions |
Returns
Promise<OutputFile[]>
Stable
Added in XTL 1.x (ADR-0075); additive to the frozen convert.
Example
const outputs = await convertJson(templateBuffer, {
version: 'xl3-source-json/0.1',
sources: {
default: { headers: ['Customer', 'Amount'], rows: [['Acme', 100]] },
},
});