ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Imports an XLS or XLSX file into a data file in HFSQL Classic or Client/Server format (data file described in the data model editor, or declared by HDeclare, HDeclareExternal or HDescribeFile).
Example
// Import "C:\MyFiles\Customer.xls" into the Customer data file.
// The Customer data file will be overwritten if it already exists (hImpCreation constant)
// A progress bar will be displayed in PROGBAR_ProgBar1
HImportXLS(Customer, "C:\MyFiles\Customer.xls", 1, "", hImpCréation, PROGBAR_ProgBar1)
Syntax
<Result> = HImportXLS(<Data file> , <Path of the XLS or XLSX file> [, <Worksheet number> [, <List of destination items> [, <Options> [, <Progress Bar>]]]])
<Result>: Boolean
  • True if the operation was performed,
  • False if an error occurred.
    HError is used to identify the problem.
<Data file>: Character string
Name of the HFSQL data file into which the import must be performed.
Remark: If the HFSQL data file used does not physically exist, it will be automatically created.
<Path of the XLS or XLSX file>: Character string
Full access path to XLS or XLSX file to import.
Linux Only the XLSX files can be used.
<Worksheet number>: Optional integer
Worksheet number in the XLS or XLSX file to import.
If this parameter is not specified, the first worksheet in the XLS or XLSX file will be imported.
<List of destination items>: Optional character string
List of names of items in the data file into which the import will be performed. The names can be delimited by single quotes and they are separated by commas or CR characters.
The names of the composite key items, binary memo items and binary items are ignored.
The non-imported items will be initialized with their default value described in the analysis.
If this parameter is not specified or if it corresponds to an empty string, all the items are imported (except the composite keys, the binary items and the binary memos) in the physical order of description.
<Options>: Optional Integer constant (or combination of constants)
Configures the type of import to perform:
hCopyAutoIDThe automatic identifier is copied. It is not recalculated.
hDefaultValFor the non-imported items, the values of the current record are reinitialized:
  • with their default value if the hDefaultVal constant is specified.
  • with the value of the corresponding items in the current record before the call to HImportXLS if the hDefaultVal constant is not specified.
hImpBreakableThe import can be interrupted by pressing the Esc key on the keyboard.
If the import is interrupted, the imported records are kept in the data file.
hImpCreationIf the import data file exists, it is overwritten.
hImpIgnoreEmptyItemIf one or more items are not filled in the XLS file, the corresponding rows are still imported.
The missing items contain:
  • the default value of items if the hDefaultVal constant is specified.
  • the value of items in the current record before the call to HImportXLS.
hImpIgnoreFirstLineThe first row of the imported XLS file is ignored.
hImpNormal
(default value)
If the import data file already exists, it is filled with the imported data ; otherwise, the data file is created.
No management of integrity and no management of duplicates.
The non-imported items take the value of the current record.
The automatic identifiers are recalculated.
OLE DBNative Connectors (Native Accesses) The management of integrity and duplicates is always enabled.
hImpTestDuplicatesEnables the management of duplicates on unique keys during the import (the management of duplicates is enabled on unique keys only and not on the entire record).
OLE DBNative Connectors (Native Accesses) The management of duplicates is always enabled.
hImpTestIntegrityChecks the integrity during the import.
OLE DBNative Connectors (Native Accesses) The management of integrity is always enabled.
<Progress Bar>: Optional control name or window name
  • Name of the window in which the progress bar will be displayed,
  • Name of the Progress Bar control.
WEBDEV - Server code This parameter is not available.
Component: wd290hf.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help