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

XL.LoadBookPartially

Loads a Excel file partially.

Component Version macOS Windows Linux Server iOS SDK
XL 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XL.LoadBookPartially"; Data; SheetIndex; FirstRow; LastRow { ; Type; keepAllSheets } )   More

Parameters

Parameter Description Example Flags
Data Either text with file path or container value which contains the Excel file data. "C:\test\test.xls"
SheetIndex The index of the sheet to delete. This number ranges from 0 to XL.Book.SheetCount-1. 0
FirstRow The first row index to load.
Starts with 0 for first one.
0
LastRow The last row index to load. 100
Type Which type of file this is.
Pass 0 for unknown, 1 to try xml format (xlsx) and 2 to try binary format (xls).
0 Optional
keepAllSheets Available in MBS FileMaker Plugin 14.2 or newer.
If this is true, all sheets are saved back with XL.Book.Save function,
But only one specified sheet is available for processing, thus LibXL can save more memory. It works only for xlsx files, LibXL ignores this flag for xls files.
false Optional

Result

Returns book reference number on success.

Description

Loads a Excel file partially.
Loads a file only with specified sheet index and row range into memory.
Works with both XML based xlsx files and older xls files.
Book reference numbers are starting at 19000 and counting up for each new book.

Examples

Try partial loading:

# Load second sheet
Set Variable [ $bookRef ; Value: MBS( "XL.LoadBookPartially"; XL::ExcelFile; 1; 0; 100) ]
Set Field [ XL::Result ; $bookRef ]
If [ MBS("IsError") ]
    Show Custom Dialog [ "Error" ; $bookRef ]
    Exit Script [ Text Result: ]
End If
# First row
# Save to container and cleanup
Set Field [ XL::OutputFile ; MBS("XL.Save"; $bookRef; "test.xlsx") ]
Set Variable [ $r ; Value: MBS( "XL.Book.Release"; $bookRef) ]
Set Field [ XL::Result ; $r ]

See also

Release notes

Blog Entries

This function checks for a license.

Created 10th January 2018, last changed 10th April 2024


XL.LoadBook - XL.NewBook