ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XLS file functions
  • Number of rows in an XLS file
xlsNbRow (Example)
Number of rows in an XLS file
The following code is used to find out the number of rows in an XLS file. The rows that are entirely empty are not taken into account (True). This file was opened by xlsOpen.
// Declare the variables
XLSFileID is int
ResNbRows is int
// Open an XLS file
XLSFileID = xlsOpen("C:\MyDirectories\MyFiles\File.XLS")
IF XLSFileID <> -1 THEN
// Number of rows
ResNbRows = xlsNbRow(XLSFileID, True)
IF ResNbRows <> -1 THEN
IF ResNbRows = 0 THEN
 // No row was found
 Info("The XLS file contains no row")
ELSE
 // Display the number of rows
 Info("The file contains: " + ResNbRows + "rows")
END
ELSE
// Display the error message
Error(xlsMsgError(XLSFileID))
END
ELSE
// Display an error message if the opening was not performed
 Error(xlsMsgError(XLSFileID))
END
// Close the XLS file
xlsClose(XLSFileID)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help