Posted 9 January 2025, 6:33 pm EST
In my React project, I use SpreadJS table like shown below -
const sheet = workbook.getActiveSheet()
const table = sheet.tables.addFromDataSource(
'table',
0,
0,
dataWithSelectedColumns, // this is a json object, which I later want to export
tableTheme,
{
showFooter: false,
showHeader: true,
showResizeHandle: true,
}
)
Although I don’t keep “dataWithSelectedColumns” in state, I do hold the spread instance in a ref variable, and I would like to get back the data source from the table. How can I do that? I have tried using toJSON( { includeBindingSource: true }), but it has a lot of metadata, and I’d have to transform the code to obtain the original data source.
Is there a faster, simpler way to achieve this?
Thank you!