Copying worksheets

Overview

The copy worksheet instruction allows a user to copy a whole worksheet from a particular Excel workbook to another Excel workbook. The instruction can be configured to either 1) append a copy of the worksheet to the Target file under any name the user chooses to specify, or 2) replace a worksheet in the Target file if the user has specified the name of the worksheet to be replaced.

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.

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:

The target file that we are going to use is a standard fresh Excel workbook which contains 3 empty worksheets.

Steps

1. Create a ‘Copy worksheet’ instruction.

2. Link the file named “Source” as the source file and the file named “Target” as the target file.

3. For the Source file, select Sheet1.

4. Type “New Sheet” into the New Worksheet Name field. This will allow Sheet1 to be appended to the end of Target workbook under the name of “New Sheet”. If a worksheet with the name of “New Sheet” already exists in the Target workbook, the step will fail. However, if a worksheet with the name of “New Sheet” already exists in the Target workbook, an user can simply tick the ‘Replace worksheet if already exist?’ checkbox so that Sheet1 will replace it (under the name of “New Sheet”).

5. Save and run the step.

6. After the step finishes running, download and open the target file. It will resemble the image below:

Leave a Reply

Latest Tweets

Free eBook: 10 Tips for sourcing good data yucalc.com/2017/02/17/fre…

reply · retweet · favorite

Newsletter

By signing up, you agree to our Terms of Service and Privacy Policy.

Address

Suite 1506, Westfield Tower 2, 101 Grafton St Bondi Junction NSW 2022 Australia

View Larger Map

Contact Us

AUS: +61-2-9386-0202
UK: +44-20-8123-1251
Send us an email

ContactUs.com
WordPress Image Lightbox