A apty Active Member Licensed User Longtime User Apr 17, 2014 #1 I have an excel worksheet with the following fields: HTML: Copy Name Address Date Amount A ABC XX 1253 B BHCN IJ 2156 I would like to select only name and amount and display on labels (I treat name as the primary key in this case). Is this possible in basic4android? Kindly assist
I have an excel worksheet with the following fields: HTML: Copy Name Address Date Amount A ABC XX 1253 B BHCN IJ 2156 I would like to select only name and amount and display on labels (I treat name as the primary key in this case). Is this possible in basic4android? Kindly assist
DonManfred Expert Licensed User Longtime User Apr 17, 2014 #3 I dont think that you can read xls or the newer versions.... But you can export your sheet as CSV. That file can be easily parsed and getting the infos you need/want... Upvote 0
I dont think that you can read xls or the newer versions.... But you can export your sheet as CSV. That file can be easily parsed and getting the infos you need/want...
DonManfred Expert Licensed User Longtime User Apr 17, 2014 #4 If you are familar with php then you could use https://code.google.com/p/php-excel-reader/ to parse and extract the data 1. Upload xls (not xlsx) from you app to your webserver 2. call the php-script from your app which reads the xls and response the data as jsonstring back to your app Upvote 0
If you are familar with php then you could use https://code.google.com/p/php-excel-reader/ to parse and extract the data 1. Upload xls (not xlsx) from you app to your webserver 2. call the php-script from your app which reads the xls and response the data as jsonstring back to your app
A apty Active Member Licensed User Longtime User Apr 17, 2014 #5 I can easily convert the file to CSV..how will I select only the columns I want if the file is CSV? Upvote 0
NJDude Expert Licensed User Longtime User Apr 17, 2014 #6 Read the StringUtils library documentation, especially the LoadCSV part. Last edited: Apr 17, 2014 Upvote 0
A apty Active Member Licensed User Longtime User Apr 17, 2014 #7 The stringutils loads the entire CSV file. I need only specific columns Upvote 0
DonManfred Expert Licensed User Longtime User Apr 17, 2014 #10 Read the file line for line split one line (with Regex.split) on each "," to get the values of this line... iterate through all lines to get the values you need. But i prefer to suggest to read the beginners guide. Do your first steps and then you use the forum search to find examples of how to do the above... Upvote 0
Read the file line for line split one line (with Regex.split) on each "," to get the values of this line... iterate through all lines to get the values you need. But i prefer to suggest to read the beginners guide. Do your first steps and then you use the forum search to find examples of how to do the above...
NJDude Expert Licensed User Longtime User Apr 17, 2014 #11 Regex Split is not the right way to parse a CSV, using StringUtils will load the CSV into a List and the rows are an array, there are samples posted on the forums. There's also the Excel library. Last edited: Apr 17, 2014 Upvote 0
Regex Split is not the right way to parse a CSV, using StringUtils will load the CSV into a List and the rows are an array, there are samples posted on the forums. There's also the Excel library.
Erel B4X founder Staff member Licensed User Longtime User Apr 18, 2014 #12 As NJDude wrote you can use the Excel library to open XLS files and read any cell you like. Upvote 0
A apty Active Member Licensed User Longtime User Apr 18, 2014 #13 Hi Erel, Please help with a sample code to read a cell. The example code for excel library reads entire file. I need only specific cells Upvote 0
Hi Erel, Please help with a sample code to read a cell. The example code for excel library reads entire file. I need only specific cells
Erel B4X founder Staff member Licensed User Longtime User Apr 18, 2014 #14 Code: Copy Dim workbook1 As ReadableWorkbook Dim moviesSheet As ReadableSheet workbook1.Initialize(Dir, FileName) moviesSheet = workbook1.GetSheet(0) Log(moviesSheet.GetCellValue(0, 0)) Log(moviesSheet.GetCellValue(0, 1)) Upvote 0
Code: Copy Dim workbook1 As ReadableWorkbook Dim moviesSheet As ReadableSheet workbook1.Initialize(Dir, FileName) moviesSheet = workbook1.GetSheet(0) Log(moviesSheet.GetCellValue(0, 0)) Log(moviesSheet.GetCellValue(0, 1))
A apty Active Member Licensed User Longtime User Apr 18, 2014 #15 Thanks Erel, I will try this Upvote 0