Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
XL.CopySheet
Copies a sheet to another book.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XL | 6.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
bookRef1 | The reference to the source workbook. Please use XL.LoadBook to load a file. | $ref | |
bookRef2 | The reference to the destination workbook. Please use XL.LoadBook to load a file. | $ref | |
sheetIndex | The index of the sheet. This number ranges from 0 to XL.Book.SheetCount-1. |
0 | |
Options | Which items to skip when copying content. | "" | Optional |
Result
Returns OK or error.
Description
Copies a sheet to another book.This copies most properties and all cells.
If something is missing, please let us know.
Option | Description. |
SkipPictures | Don't copy pictures. |
SkipMerges | Don't copy merged cells. |
SkipNamedRanges | Don't copy named ranges. |
SkipPrintArea | Don't copy print area. |
SkipPrintRepeat | Don't copy print repeat |
SkipPrintFit | Don't copy print fit. |
SkipHorPageBreak | Don't copy horizontal page breaks. |
SkipComments | Don't copy cell comments. |
SkipFormats | Don't copy formats. |
SkipRowHidden | Don't copy hidden rows. |
SkipColHidden | Don't copy hidden columns. |
Examples
Merge two Excel documents:
# Load 2 existing books
Set Variable [ $$Book_WKPI ; Value: MBS( "XL.LoadBook"; SheetCopy::XLSX1; 0 ) ]
Set Variable [ $$Book_MKPI ; Value: MBS( "XL.LoadBook"; SheetCopy::XLSX2; 0 ) ]
#
# Make sure sheets have names
Set Variable [ $mbs ; Value: MBS( "XL.Sheet.SetName"; $$Book_MKPI; 0; "Monthly" ) ]
Set Variable [ $mbs ; Value: MBS( "XL.Sheet.SetName"; $$Book_WKPI; 0; "Weekly" ) ]
#
# copy one to other
Set Variable [ $mbs ; Value: MBS( "XL.CopySheet"; $$Book_MKPI; $$Book_WKPI; 0 ) ]
#
# save result in container
Set Variable [ $fileName ; Value: Substitute("Statistic__" & Substitute (Get(CurrentDate);".";"-") & "_" & Substitute(Get(CurrentTime); ":"; "-") & ".xlsx"; " Uhr"; "") ]
Set Field [ SheetCopy::ResultXLSX ; MBS("XL.Book.Save"; $$Book_WKPI; $fileName) ]
#
# save result to desktop
Set Variable [ $path ; Value: Get(DesktopPath) & $fileName ]
Export Field Contents [ SheetCopy::ResultXLSX ; “$Path” ; Automatically open ; Create folders: Off ]
#
# Cleanup
Set Variable [ $r ; Value: MBS( "XL.Book.Release"; $$Book_MKPI ) ]
Set Variable [ $r ; Value: MBS( "XL.Book.Release"; $$Book_WKPI ) ]
See also
Release notes
- Version 12.5
- Fixed a but in XL.CopySheet, where it failed if the sheet didn't have a name.
- Version 9.0
- Added options for XL.CopyContent, XL.CopyRow, and XL.CopySheet to skip some content.
Blog Entries
- MBS FileMaker Plugin, version 12.5pr1
- LibXL for FileMaker with extras
- MBS FileMaker Plugin, version 9.0pr7
- MBS FileMaker Plugin, version 9.0pr6
- MBS FileMaker Plugin, version 6.5pr10
This function checks for a license.
Created 7th December 2016, last changed 16th September 2022