Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

XL.Sheet.RemoveRow

Removes rows from rowFirst to rowLast.

Component Version macOS Windows Linux Server iOS SDK
XL 3.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XL.Sheet.RemoveRow"; bookRef; sheetIndex; rowFirst; rowLast { ; KeepRanges } )   More

Parameters

Parameter Description Example Flags
bookRef The reference to the 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
rowFirst The first row for the area. First row has index 0. $row
rowLast The last row for the area. $row+1
KeepRanges Available in MBS FileMaker Plugin 10.2 or newer.
If 1, the ranges are kept and not updated.
Default is 0 to update ranges.
0 Optional

Result

Returns OK or error.

Description

Removes rows from rowFirst to rowLast.

Examples

Preprocess file before import in FileMaker by removing a row and a sheet:

# Find libXL and load it
If [ MBS("XL.IsInitialized") ≠ 1 ]
    Perform Script [ Specified: From list ; “InitXL” ; Parameter: ]
End If
#
# path to xls or xlsx file
Set Variable [ $path ; Value: MBS( "Path.AddPathComponent"; MBS( "Folders.UserDesktop" ); "test.xls" ) ]
#
# Load template excel file
Set Variable [ $bookRef ; Value: MBS( "XL.LoadBook"; $path) ]
If [ MBS("IsError") ]
    Show Custom Dialog [ "Error" ; $bookRef ]
    Exit Script [ Text Result: ]
End If
#
# Remove first row of first sheet
Set Variable [ $r ; Value: MBS( "XL.Sheet.RemoveRow"; $BookRef; 0 /* sheet index */; 0 /* row index */) ]
#
# Remove second sheet
Set Variable [ $r ; Value: MBS( "XL.Book.DeleteSheet"; $bookRef; 1 /* sheet index */ ) ]
#
# Save to file and cleanup
Set Field [ XL::OutputFile ; MBS("XL.Book.SaveToFile"; $bookRef; $path) ]
Set Variable [ $r ; Value: MBS( "XL.Book.Release"; $bookRef) ]
#
# now let FileMaker import file

Remove three rows:

Set Variable [ $r ; Wert: MBS( "XL.Sheet.RemoveRow"; $book; $sheet; 3; 5; 1) ]

See also

This function checks for a license.

Created 18th August 2014, last changed 9th December 2023


XL.Sheet.RemovePictureByIndex - XL.Sheet.RemoveSelection