Xbasic

excel_to_resultset Function

Syntax

dim result as SQL::ResultSet (filename as c [, sheetname as c])

Arguments

filenameCharacter

The file name of the Excel file.

sheetnameCharacter

Default = the first sheet. The name of the Excel sheet to read records from. If you do not specify a value, the first sheet in the file is assumed.

Description

Takes an Excel file and returns a SQL::Resultset object.

Discussion

The excel_to_resultset() function loads an Excel file and returns a SQL::Resultset object that can be used to iterate over the data in the Excel file. You can optionally specify the name of a sheet in the file. If you do not specify a sheetname, the first sheet in the file is assumed.

Example

dim fn as c = "C:\excelfiles\myExcelDoc.xlsx";
dim rs as SQL::ResultSet

rs = excel_to_resultset(fn, "products")

See Also