The [highlight txt=’copy chart’] instruction allows a user to copy a chart which exists within a particular Excel worksheet into another Excel worksheet. The chart to be copied can be referred to by its Name, Title, or Index. The instruction also allows for the chart to be copied as a picture, rather than an interactive Excel chart.[message type=”warning”]For the purposes of this article we are going to use two simple and fictitious Excel files. They have already been uploaded into a data step. You will want to replace these files with those of your own.[/message]
Before we get started
Please further create a ‘Manipulate a file’ or ‘Multiple file manipulations’ action step so that you can add and use instructions.
The source file that we are going to use looks like this:
As you can see, a column chart has been created over a series of data. This is the chart that we will attempt to copy. The name of the chart is “Chart 1”.
The target file that we are going to use looks like this:
As you can see, the data from cell A1 to cell B5 in the source file is the same as the data from cell A1 to cell B5 in the target file. Note that this instruction only copies the chart itself, that is, the design, layout, format, and the cell references of the range of data referred to by the chart. The instruction does not copy the data referred to by the chart as it exists in the source file. Therefore, you may want to run a ‘copy cell values’ instruction before or after running this instruction. For help as to how to run a ‘copy cell values’ instruction, see How to copy cell values . Alternatively, you can configure this instruction to copy the chart as a picture.
1. Create a ‘Copy chart’ instruction.
2. Link the file named “Source” as the source file and the file named “Target” as the target file.
3. Select Sheet1 from both files.
4. Use cell D1 as the target cell.
5. The reference method rule is set to ‘Chart Name’ automatically.
6. From the dropdown to the right of ‘Chart Name,’ select “Chart 1”.
7. Save and run the step.
8. After the step finishes running, download and open the target file. It will resemble the image below: