B4J Question Find the last empty row of Excel file

MJA_Hack

Member
Hello
I have an Excel file that is already designed and has content
The program is designed in such a way that when the user clicks on the save in Excel file option in the menu, the content of several strings and numbers will be saved in the specified sheet and columns of this Excel file.

Currently, my problem is that I don't know how to determine what is the last row stored in that text?
I use XLUtils and XLWorkbookWriter method to save Excel file
Please help me, when I open the Excel file, it will be clear, for example, what row is the last empty row of column B?

frist code:
Dim Workbook As XLWorkbookWriter = xl.CreateWriterFromTemplate("C:\Users\*****\Desktop\New folder", "1.xlsx")
Dim sheet1 As XLSheetWriter = Workbook.CreateSheetWriterByName("Sheet1")
 

emexes

Expert
Licensed User
Currently, my problem is that I don't know how to determine what is the last row stored in that text?
I use XLUtils and XLWorkbookWriter method to save Excel file
Please help me, when I open the Excel file, it will be clear, for example, what row is the last empty row of column B?

This might be in the ballpark (I can't try it out here at moment) :

XLReaderResult also includes a TopLeft and BottomRight addresses fields. They can be used to find the end of document.
...
B4X:
For Row1Based = 6 To result.BottomRight.Row0Based + 1

I feel like the For limit should be - 1 row rather than + 1 row but perhaps it is intentional to ensure that it reaches an empty row to exit the For loop. šŸ¤”
 
Upvote 0
Top