DocsUpdated 18 Oct 2026
Import data to Docly from Excel (XLSX)
An example on how to import data from Excel to Docly.
These functions are only available from the #/API folder and users with developer access.
Import data from Excel to Docly
Filename: #/API/Import.js
export default () => {
// An import writes documents, so it must never run on a GET (a link could trigger it).
if (request.method != "POST") throw new Error("Verb not supported");
// Only users who may edit the data folder may import into it.
if (!request.user || !docly.allowModify("#/Data", request.user)) return docly.denyAccess();
let xlsx = docly.loadExcel("#/Import/Import1.xlsx");
let saved = 0;
for (let item of xlsx) {
// Save a document only if the Name column has a value
if (!item.Name) continue;
let data = {
"Age": item.Age,
"Phoneno": item.Phoneno,
"Email": item.Email,
"Country": item.Country
};
// Under #/ so the imported personal data is never served from the site.
docly.saveFile("#/Data/" + item.Name, data, { schema: "#/My schema", ensurePath: true });
saved++;
}
return { "Saved": saved };
} Saves every row with a name as a document in the folder #/Data, which is never served from the site. Call the endpoint with POST.