Hi Sudhi, very useful video, Thanks, I exactly followed your steps and got the results. Is it possible to add multiple charts and multiple tables of the same sheet. Please recommend some ideas to the query.
Hi Sudhi. I am curious as to why your script in the video here does not match the script in the online article I found. Everything is the same with the exception of the function updateRange. The script does not have that function. There are some lines as part of the first function that say it is adding the selected data to the new worksheet. Has something changed since you first recorded this whereas the function is no longer needed to add the data?
Hi Sudhi, for some users, the images do not show in the outlook email but instead show a red X. Do you know what could be the issue? Many thanks in advance!
If you don't need the table, just remove all references to the table and just keep the chart part in the source - github.com/sumurthy/officescripts-projects/blob/main/Chart%20and%20Table%20Images/ReportImages.ts If you already have a chart and don't need to create it, then just use the get APIs to get the chart and then get its image (rather than creating it new). // Get chart 1 from Sheet1. const chart_1 = workbook.getWorksheet('Sheet1').getChart('Chart 1'); const chartImage = chart_1.getImage(); LMK if you need more help.
@@davecotr I don't know the scenario to give you the exact script. If you have the chart all ready to go (you don't need to create it), then the following script will work. You can use the chartImage property in the email just like I show in the video. If you need to add a chart to begin with, then use the addChart() API shown in my video and then get the chart image. SCRIPT: function main(workbook: ExcelScript.Workbook): ReportImages { const chartSheet = workbook.getWorksheet('ChartSheet'); // Insert chart on sheet 'Sheet1' const chart = chartSheet.getCharts()[0]; //It gets the first chart // const chart = chartSheet.getCharts('Chart 1'); // if you know the name const chartImage = chart.getImage(); return { chartImage } } interface ReportImages { chartImage: string }
@@s65012r I have 2 charts in my excel sheet and when I used the given script I get an error while testing the flow. And the error is "Cannot read property 'getImage'. Any advice on this?
Hi Sudhi, Thank you for such a nice demonstration of automating tasks through office scripts and power automation.
Hi Sudhi, very useful video, Thanks, I exactly followed your steps and got the results.
Is it possible to add multiple charts and multiple tables of the same sheet. Please recommend some ideas to the query.
Hi Sudhi. Is there a way to get images of multiple tables in worksheet and email each image to different individuals?
Really useful and good video. Thank you !
Hi Sudhi. I am curious as to why your script in the video here does not match the script in the online article I found. Everything is the same with the exception of the function updateRange. The script does not have that function. There are some lines as part of the first function that say it is adding the selected data to the new worksheet. Has something changed since you first recorded this whereas the function is no longer needed to add the data?
Video was really helpful, can we pass that table range to my email body in power automate flow, instead of sending it as image ?
Hi Sudhi, for some users, the images do not show in the outlook email but instead show a red X. Do you know what could be the issue? Many thanks in advance!
Hi! Thanks for the video! What would my code look like if I just pinned an image from my spreadsheet to a range? For example (A2:C4)
Hi. I did it step by step, but the email what i got does not contain any pictures. Can you help me to solve this problem?
thank you your video was very interesting. What part of the code should I use to export just the chart?
If you don't need the table, just remove all references to the table and just keep the chart part in the source -
github.com/sumurthy/officescripts-projects/blob/main/Chart%20and%20Table%20Images/ReportImages.ts
If you already have a chart and don't need to create it, then just use the get APIs to get the chart and then get its image (rather than creating it new).
// Get chart 1 from Sheet1.
const chart_1 = workbook.getWorksheet('Sheet1').getChart('Chart 1');
const chartImage = chart_1.getImage();
LMK if you need more help.
@@s65012r tnx for the reply but it doesn' t work. I also tried to change const with a variables but without results. Do you have any tips?
@@davecotr I don't know the scenario to give you the exact script.
If you have the chart all ready to go (you don't need to create it), then the following script will work. You can use the chartImage property in the email just like I show in the video.
If you need to add a chart to begin with, then use the addChart() API shown in my video and then get the chart image.
SCRIPT:
function main(workbook: ExcelScript.Workbook): ReportImages {
const chartSheet = workbook.getWorksheet('ChartSheet');
// Insert chart on sheet 'Sheet1'
const chart = chartSheet.getCharts()[0]; //It gets the first chart
// const chart = chartSheet.getCharts('Chart 1'); // if you know the name
const chartImage = chart.getImage();
return {
chartImage
}
}
interface ReportImages {
chartImage: string
}
@@s65012r I can not thank you enough, this has been incredibly helpful!
@@s65012r I have 2 charts in my excel sheet and when I used the given script I get an error while testing the flow. And the error is "Cannot read property 'getImage'. Any advice on this?