Reputation: 1
I have the following code below.
const SHEET_NAMES = ["BaseGraficos"];
function main(wb: ExcelScript.Workbook): string {
const sheets = SHEET_NAMES.map((name) => wb.getWorksheet(name));
const htmlBody = createHtmlBody(sheets);
return htmlBody;
}
function createHtmlBody(sheets: ExcelScript.Worksheet[]) {
let html = `<table>`;
sheets.forEach((sheet) => {
const charts = getChartFromSheet(sheet);
charts.forEach((chart) => {
html += `<tr><td><h3>${sheet.getName()}</h3></td></tr>`;
html += `<tr><td><img src="${chart}"></td></tr>`;
});
});
html += `</table>`;
return html;
}
function getChartFromSheet(sheet: ExcelScript.Worksheet) {
const charts = sheet.getCharts();
return charts.map((chart) => {
return `data:image/png;base64,${chart.getImage()}`;
});
}
It will provide me with an HTML table with the charts from my BaseCharts spreadsheet. In Power Automate, I have a flow that will take this HTML table and assemble the body of the email.
However, when putting together the email, it is noticed that the axes of most of the charts get messed up>
Here is one that i got mailed:
And here is the one thats in my sheet:
Can someone tell me what am I doing wrong??
Here is the Excel file without sensitive data:
Here is the flow (triggered by recurrence): flow
Here is the error from my Copy and Paste Script:
Upvotes: 0
Views: 126