i have created the Excel table called 'subjectHubTable', where the data came ti this EXCEL context through a API endpoint.
const addSubjectIntoSheet = async () => {
const allSubjects = await hubReportService.getAllSubjects();
const formatedSubjects = formatSubjectForExcel(allSubjects);
//const formatedSubjects = allSubjects.map(({...rest}) => Object.values(rest));
console.log("Formated");
console.log(formatedSubjects);
await Excel.run(async (context) => {
const studentColumn = ["id", "Name", "Code", "academic_year", "department_code"];
const currentWorksheet = context.workbook.worksheets.getActiveWorksheet();
const subjectHubTable = currentWorksheet.tables.add('A1:E1', true);
subjectHubTable.name = "subjectHubTable";
subjectHubTable.getHeaderRowRange().values = [studentColumn];
subjectHubTable.rows.add(null /*add at the end*/, formatedSubjects);
//studentTable.columns.getItemAt(3).getRange().numberFormat = [["\u20AC#,##0.00"]];
subjectHubTable.getRange().format.autofitColumns();
subjectHubTable.getRange().format.autofitRows();
await context.sync();
});
};
Is there any founctionality to get the latest data to Excel Sheet from my custom API end points. like Refresh All in 'Data->Referesh / All' in the Excel Menu. or any possible way to achive this async data push into sheet