cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Daves1
Helper I
Helper I

Form to Excel, import graph according to excel sheet to populate Word template

Hi all

I have a flow that based on the responses received on a form> form is populated into an excel. The second sheet of this excel generates a chart that I would like to populate within a word sheet how can I do this? Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
sumurthy
Microsoft
Microsoft

Get Charts as image is possible. 

Check out this link for full details - 

https://github.com/sumurthy/officescripts-projects/tree/main/Chart%20and%20Table%20Images

 

It uses Office Scripts to extract the images as base64 that you can then email. 

 

View solution in original post

4 REPLIES 4
ChristianAbata
Super User
Super User

hi @Daves1  get Charts as images is not possible sorry. Could be a great idea you can post it here

Power Automate Ideas - Power Platform Community (microsoft.com)



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
sumurthy
Microsoft
Microsoft

Get Charts as image is possible. 

Check out this link for full details - 

https://github.com/sumurthy/officescripts-projects/tree/main/Chart%20and%20Table%20Images

 

It uses Office Scripts to extract the images as base64 that you can then email. 

 

View solution in original post

Thank you @sumurthy  since the graph is already generated, will it be enough to insert this last part of the script?

 

function updateRange(sheet: ExcelScript.Worksheet, data: string[][]): ExcelScript.Range {

  const targetRange = sheet.getRange('A1').getResizedRange(data.length-1, data[0].length-1);

  targetRange.setValues(data);

  return targetRange;

}

 

interface ReportImages {

  chartImage: string

  tableImage: string

}

 

 

I am resuming this thread because I am trying to create a code with Office script on excel online.
The code is as follows:

function main (workbook: ExcelScript.Workbook) {
  declare function require (name: string);
  let Sheet2 = workbook.getWorksheet ("Sheet2");
  var rang = Sheet2.getRanges ("J2: Q16");
  var ch = Sheet2.ChartObjects (). Add (rang.Left + rang.Width, rang.Top, 350, 220);
  ch.Chart.ChartType = 4;
  ch.Chart.SetSourceData (rang, 2);
  chartImage = ch.getImage ();
} 

but I get the following error: runtime error: Line 5: Sheet2.ChartObjects is not a function
clientRequestId: .....

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,539)