I have a spreadsheet with 21 sheets in it.
I need to read each sheet. Each sheet has 6 columns of data. Each sheets data can have different number of rows, some have 19 rows, some 20 and some 21 rows.
To read each sheets data, I would assume creating a Sheet Range on each sheet.
Excel allows you to name each sheets range the same name - I did it and saved the spreadsheet with no error. I'm naming each sheets range the same, as: "Data".
I need to read each sheets "Data" range and put that data into a SQL table.
Q: how do I define the B4J code to read a range?
I see in Erel's example the code is as:
Dim result As XLReaderResult = XL.Reader.ReadRange(File.DirAssets, "Countries of the world.xlsx", "Countries") 'named range
How does it know which sheet that range is on, especially if I name the ranges the same on all sheets, which Excel allows?
I have this code, but it returns nothing:
Dim filename As String = txtFilename.Text
Dim folder As String = File.GetFileParent(filename)
Dim name As String = File.GetName(filename)
Dim sheetname as String = "My_Sheet" 'The XLUtil library does not allow spaces in sheet names!
Dim result As XLReaderResult = XL.Reader.ReadRange(folder, name, sheetname & "!Data") '<<==== returns nothing
I know what you might say, and that is to name each range differently.
But my issue with this is Excel allows the same name for a range on each sheet. So if some other B4J developer does the same, they are going to have this issue.
So I think it needs to be addressed in the XLUtils library.
Thanx,
Mark Stuart