P101 Copy Specified Sheet Data to same or different XLS file

 

/P#

Meaning

Extra Parameters: /1{Parameter1} … /n{Nth Parameter}

101

(XLS) Copy specified data from sheet to the same or different XLS file. Can be used for appending/concatenating many sheets data to a single sheet

/1 = sInputSheet (by name or by number)

/2 = lWhatToCopy

0 = Values (DEFAULT) 

1 = Formulas 

2 = Values and Number Formats 

3 = Formulas and Number Formats 

4 = All 

5 = Comments 

6 = Formats 

7 = Validation 

8 = All Except Borders 

9 = Column Widths 

 

/3 = bCopySheetName ("TRUE" or "FALSE")

/4 = bCopyFromSpecifiedRange ("TRUE" or "FALSE")

/5 = sSpecifiedRangeToCopyFrom

/6 = sOutputSheet (by name or by number)

/7 = bCopyToSpecifiedRange ("TRUE" or "FALSE")

/8 = sSpecifiedRangeToCopyTo

/9 = bCopyColumnWidths ("TRUE" or "FALSE")

This special process can copy the information you specify from one worksheet to another within the same or different workbook.

NOTE: If you specify a whole folder of Excel files, you can concatenate/append the data into a single sheet.

Special Parameters Described in Detail

Note: You don't have to specify Boolean (TRUE/FALSE) parameters that are FALSE. Nor do you have to specify parameters that are empty.

/1{sInputSheet} specifies the name or index of the sheet to copy data from.

/2{lWhatToCopy} is used to specify what to copy from the worksheet. For example to copy Values use /2 0

If this switch is left out, the Values will be copied by default.

/3{bCopySheetName} should be set to "TRUE" if you want the newly created worksheet to have the same name as the input worksheet. bCopySheetName can be true only if you are creating a new workbook by specifying an Output Target File (/T) that is different from the Input File (/S). This is because a Workbook file (XLS) can only have uniquely named sheets. This parameter is typically only used when sInputSheet specifies the sheet by an index number. Multiple input sheets are not possible when setting this parameter to TRUE.

/4{bCopyFromSpecifiedRange} should be set to "TRUE" if you plan on using the sSpecifiedRangeToCopyFrom parameter, otherwise set it to "FALSE". If set to "FALSE" the entire 'Used Ranged' will be copied.

/5{sSpecifiedRangeToCopyFrom} is used to select a portion of a sheet to copy the data from. Typical Excel syntax is acceptable. For example "A1:B10", "J5:K20, Z20", etc. If this parameter is blank, the entire used portion of the worksheet will be copied.

/6{sTargetSheet} specifies the name or index of the sheet to copy data to.

/7{bCopyToSpecifiedRange} should be set to "TRUE" if you plan on using the sSpecifiedRangeToCopyTo parameter, otherwise set it to "FALSE". If set to "FALSE", the data will be placed beginning at cell A1.

/8{sSpecifiedRangeToCopyTo} is used to select exactly where to place the copy data to within the output worksheet, sTargetSheet. Typical Excel syntax is acceptable. For example "A1:B10", "J5:K20", etc. If this parameter is blank, it is placed beginning at cell A1. If the range specified is smaller than the copied data's range, the data will be truncated. To copy the data below already existing data, set this parameter to "below". To copy the data to the right of existing data, set this parameter to "right".

HINT: To specify the location to begin copying the data to (without the needing figure out the destination range) simply specify a single cell (i.e. "B10"). All the copied data will be placed starting at this cell.

/9{bCopyColumnWidths} In addition to copying values, formulas, formats, comments etc, you can also, at the same time specify to copy the column widths. Use /9TRUE to copy column widths, /9FALSE to not. If this switch is left out, it defaults to FALSE.

Examples:

EXAMPLE 1: Copy all values from one sheet to another, within same workbook

EXAMPLE 2: Copy specified range of formula from one workbook to another

EXAMPLE 3: Append sheet data from a folder of workbooks to a single sheet

EXAMPLE 4: Example 4 Copy ALL including column widths from one workbook to another

P101 Copy Specified Sheet Data to same or different XLS file