xlsxform
v0.1.1
Published
TypeScript port of pyxform - converts XLSForms to ODK XForms
Readme
xlsxform
TypeScript port of pyxform — converts XLSForms to ODK XForms.
Installation
npm install xlsxformUsage
import { convert } from "xlsxform";
// From a workbook dict (plain JS object)
const result = convert({ xlsform: workbookDict, formName: "my_form" });
console.log(result.xform); // XForm XML string
// From an XLSX WorkBook (requires the optional `xlsx` peer dependency)
import * as XLSX from "xlsx";
const wb = XLSX.read(fileBuffer, { cellDates: true });
const result = convert({ xlsform: wb, formName: "my_form" });
// From a Markdown table (handy for tests)
const result = convert({
xlsform: `
| survey | | | |
| | type | name | label |
| | text | name | Name? |
`,
fileType: "md",
});convert() returns an object with:
xform— the generated XForm XML stringwarnings— any conversion warningsitemsets— external itemsets XML, if applicable
See the source types for the full options and return type.
