Developer log #26 :: The Fastest Way to Get Excel Data into Your Wiki
Introduction
Do you regularly receive Excel exports from another system, such as financial software, CRMs, or online forms, and need to get that data into your wiki? Manually creating pages every week (or even every day) from the same kind of spreadsheet quickly becomes repetitive, error-prone, and a waste of time.
We wanted a smarter, repeatable solution: the ability to automatically import Excel sheets with a consistent layout and turn them into fully structured wiki pages, again and again.
In this developer log, we’ll show you how to build a robust import system using FlexForm and the ArrayFunctions extension. Whether you’re importing invoices, user submissions, or updates from external tools, this solution helps you turn recurring spreadsheets into dynamic wiki content. Without the manual hassle.
Use cases
To give you an idea for potential use cases, let me throw some at you to think about and we I'll go into detail for one of those use cases.
Simple integrations with other tools You want to integrate data from another application, but building a full API connection is not feasible. Since most tools offer Excel exports, this method allows you to create a reliable integration with significantly less effort and cost.
Online form submissions to wiki pages You collect data through an online form that exports to Excel. With this setup, each submission can automatically generate or update a structured wiki page.
Recurring financial or CRM exports Weekly or monthly exports from your bookkeeping system or CRM can be imported directly. This keeps your wiki updated without needing to manually enter the same type of data each time.
Bulk data entry or migration When onboarding existing data into the wiki, such as a list of team members or archived reports, an Excel file can be used to quickly create multiple pages.
Simplifying data entry for non-technical users Colleagues who are not familiar with wikitext can fill out a spreadsheet. That data can then be imported to generate properly structured pages using wiki templates.
How will it work?
Before diving into the details, let’s take a step back. This solution combines FlexForm and the ArrayFunctions extension to make everything happen. FlexForm handles the spreadsheet upload and converts the content into a JSON format. Then, ArrayFunctions reads that JSON data and feeds it into a dynamic FlexForm form. This form can then create or update wiki pages automatically, based on the data in each row.
Do you want to try or experiment with this import? If you have the PageSync extension installed, you can install the sharefile on this special page: /Special:WSps?action=share. Note that we use the slot with name 'ws-data', so you might need to change that.
3. Use the Sample Excel Sheet
This example will create person pages based on a spreadsheet with person data. You can download the sample sheet here. The example is simple, but you can adapt the structure to suit your needs.
4. Create the Upload Form
We need to start with being able to upload an Excel sheet and parse it to JSON data. We will create a FlexForm form for this. Here is a simple one derived from the FlexForm docs example that does the job:
The <input type="file"> accepts .xlsx files and parses them into JSON.
The action="convertfrom:xlsx" handles the transformation from Excel to JSON.
The
saves the template and redirects to the resulting page.
The slot="ws-data" stores the JSON output in a content slot. Using slots is not required, you can also save the slotdata to the main content.
5. Create the Dynamic Form Template
Now, we edit the template that is shown on the page of the Excel sheet ("Test excel convert"). We will create a 'dynamic form'.
We will loop over all persons in the data and create inputs in a form.
1<includeonly> 2<form> 3{{#af_foreach: {{#af_get: {{#invoke:CspFunctions|afExportSlots}} | 1 | ws-data }} | key | person |
4<!-- Create the person --> 5<_createmwwrite="Person/"mwtemplate="Person"mwoption="next_available"mwfields="Name{{{key}}}::Name,Country{{{key}}}::Country"/> 6<inputtype="hidden"name="Name{{{key}}}"value="{{#af_get:{{{person}}}|First Name}} {{#af_get:{{{person}}}|Last Name}}"/> 7<inputtype="hidden"name="Country{{{key}}}"value="{{#af_get:{{{person}}}|Country}}"/> 8 9<!-- List the person -->10{{#af_get:{{{person}}}|First Name}}<br>11}}
12<inputtype="submit"value="Save persons"class="btn btn-primary"/>13</form>14</includeonly>
Explanation:
af_foreach loops over each row (person) in the Excel data.
The
generates a Person/ page for each entry using the Person template.
af_get pulls individual fields like First Name, Last Name, and Country.
hidden inputs ensure the values are correctly passed when the form is submitted.
6. Done!
After uploading the Excel sheet, you are redirected to the page that contains the data (because of the mwfollow attribute). The page confirms which persons will be created, and when you click save, all the person pages are created using the Person template with the appropriate parameters.
This approach saves hours of manual work and gives you full control over how imported data is handled inside your wiki.
Lua error: bad argument #1 to 'mw.text.jsonDecode' (string expected, got nil).