I want to export the json data into an excel data and there is one column (name = Link) and in each data there should be a clickable link . i want to set hyperlink on that link
(Library used => json-as-xlsx )
``````````````````````````````````````````````````````````````````
data = [
{
sheet: "Tasks",
columns: [
{ label: "Status", value: (row) =>row.status_description==="completed"?"Pending Approval":"Accepted"},
{ label: "Req Date", value: (row) => moment(row.created_at).format('DD-MM-YYYY hh:mm:ss')},
{ label: "Task Name", value: (row) => row.fields.find(o=>o.label==="Task name")?.value },
{ label: "Title", value: (row) => row.name },
{ label: "Content Type", value: (row) => row.fields.find(o=>o.label==="Content type")?.value },
{ label: "Final word count", value: (row) => row.word_count },
{ label: "Link", value: (row) => `https://docs.google.com/document/d/${row.doc}`,type:"hyperlink"}
],
content: response.items,
}
]
let filename = `${reqData.query.project_name}-${moment().format('DD-MMM-YYYY')}`
let settings = {
fileName: filename, // Name of the resulting spreadsheet
extraLength: 1, // A bigger number means that columns will be wider
writeMode: 'writeFile', // The available parameters are 'WriteFile' and 'write'. This setting is optional. Useful in such cases https://docs.sheetjs.com/docs/solutions/output#example-remote-file
writeOptions: {}, // Style options from https://github.com/SheetJS/sheetjs#writing-options
RTL: false, // Display the columns from right-to-left (the default value is false)
}
let filepath = path.join(__dirname, `../../../${filename}.xlsx`);
let callback = function (sheet) {
console.log("Download complete:",sheet)
resolve({filepath: filepath, filename: `${filename}.xlsx`});
}
jsonAsXlsx(data, settings, callback)
}).catch((err) => reject(err));