Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
XL.Book.AddSheet
Adds a new sheet to this book, returns the sheet index.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XL | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
BookRef | The reference to the workbook. Please use XL.LoadBook to load a file. | $ref | |
Name | The name for the new sheet. | "Taxsheet" | |
InitSheet | The index of an existing sheet to use as template. Must be from the same book to copy sheet. |
0 | Optional |
Result
Returns new sheet index or error message.
Description
Adds a new sheet to this book, returns the sheet index.Use initSheet parameter if you wish to copy an existing sheet.
Note initSheet must be only from this book.
Examples
Writes sheet with red font:
#create new xls file
Set Variable [$book; Value:MBS( "XL.NewBook"; 0 )]
#create fonts
Set Variable [$redColor; Value:MBS( "XL.Color.Pack"; $book; 255; 0; 0)]
Set Variable [$redFont; Value:MBS( "XL.Book.AddFont"; $book)]
Set Variable [$r; Value:MBS( "XL.Font.SetColor"; $book; $redFont; $redColor)]
#
#create formats
Set Variable [$redFormat; Value:MBS( "XL.Book.AddFormat"; $book)]
Set Variable [$r; Value:MBS( "XL.Format.SetFont"; $book; $redFormat; $redFont)]
#
#create sheet
Set Variable [$sheet; Value:MBS( "XL.Book.AddSheet"; $book; "Sales Receipt")]
#
#add number in red
Set Variable [$r; Value:MBS( "XL.Sheet.CellWriteNumber"; $book; $sheet; 5; 3; 123; $redFormat)]
#
Set Field [Writing data::Output; MBS("XL.Book.Save"; $book; "test.xls")]
Set Variable [$r; Value:MBS("XL.Book.Release"; $book)]
See also
- XL.Book.MoveSheet
- XL.Book.Save
- XL.Book.SetActiveSheet
- XL.Date.Pack
- XL.Font.SetColor
- XL.Format.SetFont
- XL.Format.SetWrap
- XL.LoadBook
- XL.Sheet.CellWriteNumber
- XL.Sheet.SetCol
Release notes
- Version 13.0
- Fixed a problem with XL.Book.AddSheet function not passing correct name each time.
Example Databases
- XL/AutoFilter
- XL/Conditional Formatting
- XL/Export records
- XL/Sheet with colored text
- XL/Writing data
Blog Entries
- MBS Plugin Advent calendar: 13 - XL
- MBS FileMaker Plugin, version 12.6pr1
- Use formatted text in Excel files with FileMaker and LibXL
- How to use XL functions with MBS FileMaker Plugin
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 18th May 2023
