PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Content of the cells: taking the empty rows and columns into account
  • Error management
  • Type of data retrieved
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
xlsData (Function)
In french: xlsDonnée
Retrieves the content of a cell found in an XLS file. The result depends on the opening mode of XLS file:
  • In multi-sheet mode, the data retrieved is found on the worksheet selected by xlsCurrentWorksheet.
  • In compatible mode, the data retrieved is always found on the first worksheet of the workbook.
Remark: The content of a cell found in an XLS file can be retrieved if:
  • The XLS file exists.
  • The XLS file is opened.
Versions 16 and later
WINDEVLinux This function is now available for WINDEV applications in Linux.
Linux This function is now available for WEBDEV sites in Linux.
New in version 16
WINDEVLinux This function is now available for WINDEV applications in Linux.
Linux This function is now available for WEBDEV sites in Linux.
WINDEVLinux This function is now available for WINDEV applications in Linux.
Linux This function is now available for WEBDEV sites in Linux.
// Déclaration des variables
ResDonnée is string
IDFichierXLS is int
 
// Ouverture d'un fichier XLS
IDFichierXLS = xlsOpen("C:\MonRépertoire\Fichier.XLS")
IF IDFichierXLS <> -1 THEN
// Récupération de la valeur d'une cellule
ResDonnée = xlsData(IDFichierXLS, 3, 4)
...
END
cMonFicXLS is xlsDocument
 
cMonFicXLS = xlsOpen(sMonFichier, xlsWrite)
IF ErrorOccurred = False THEN
Azz is int = xlsCurrentWorksheet(cMonFicXLS)
Info("Feuille en cours dans le fichier Excel: " + Azz)
// Changement de feuille
IF xlsCurrentWorksheet(cMonFicXLS, 2) = True THEN
Info("La feuille courante a été modifiée.")
// Lecture d'une cellule pour test
Info(xlsData(cMonFicXLS, 11, 2))
ELSE
Error("Le fichier sélectionné ne comporte pas de seconde feuille!")
END
ELSE
Error(ErrorInfo(errFullDetails))
END
xlsClose(cMonFicXLS)
Syntax

Syntax that is using the xlsDocument type Hide the details

<Result> = xlsData(<XLS document> , <row Number> , <Column number> [, <Empty rows and columns>])
<Result>: Character string
  • Content of specified cell.
  • If the cell content corresponds to an empty string (""), this may correspond to an error. In this case, the ErrorOccurred variable is set to True and xlsMsgError returns the error details.
<XLS document>: xlsDocument variable
Name of the variable of type xlsDocument to be used.
<row Number>: entier
Number of the row for the cell to read.
<Column number>: entier
Number of the column for the cell to read.
<Empty rows and columns>: Optional boolean
Defines how the empty rows and columns will be taken into account:
True
(by default)
The empty rows and columns are ignored.
FalseThe empty rows and columns are taken into account.

Syntax kept for backward compatibility with version 12 Hide the details

<Result> = xlsData(<XLS file identifier> , <row Number> , <Column number> [, <Empty rows and columns>])
<Result>: Character string
  • Content of specified cell.
  • If the cell content corresponds to an empty string (""), this may correspond to an error. In this case, the ErrorOccurred variable is set to True and xlsMsgError returns the error details.
Remark: If the Excel file was opened in compatible mode, the content of the cell cannot exceed 255 characters.
<XLS file identifier>: entier
Identifier of XLS file to handle, returned by xlsOpen.
<row Number>: entier
Number of the row for the cell to read.
<Column number>: entier
Number of the column for the cell to read.
<Empty rows and columns>: Optional boolean
Defines how the empty rows and columns will be taken into account:
True
(by default)
The empty rows and columns are ignored.
FalseThe empty rows and columns are taken into account.
Remarks

Content of the cells: taking the empty rows and columns into account

The empty rows and columns can be taken into account or not. For example:
xlsData(IDFichierXLS, 2, 3, True)
// Retourne le contenu de la cellule D2: "23"
xlsData(IDFichierXLS, 2, 3, False)
// Retourne le contenu de la cellule C2: ""
In this example, the column C (that is entirely empty) can be taken into account or not.

Error management

If an error occurs, xlsData returns an empty string (""). To get the details of the error, use xlsMsgError or ErrorInfo with the errMessage constant.
xlsData throws an error in the following cases:
  • The specified row and/or column is empty.
  • The specified XLS file does not exist.
  • The specified XLS file is not opened.

Type of data retrieved

xlsData returns a string, regardless of the cell format defined in Excel.
Caution: The "High-precision numeric" type is not supported by Excel: the value of the numeric that is retrieved will be truncated.
If the content of the specified cell has the following type:The result is converted into:
DigitalString
DateString in DD/MM/YYYY format
Time of dayString in HH:MM:SS format
Component: wd270xls.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment