Android Tutorial Read / Write Excel files on Android

Status
Not open for further replies.

Devan

Member
Licensed User
Longtime User
Hi Erel,
Thank you for the advice. I will try to figure out how to do it.
Have a nice day.
 

merlin2049er

Well-Known Member
Licensed User
Longtime User
I just wanted to test this library so I created this sub and called it from a menu item.

B4X:
Sub create_newworkbook_click

Dim newWorkbook As WritableWorkbook
    newWorkbook.Initialize(File.DirRootExternal, "Inventory.xls")
    Dim sheet1 As WritableSheet
sheet1 = newWorkbook.AddSheet("Inventory", 0)

' write to cells
    Dim cell As WritableCell
    cell.InitializeText(1, 0, "Hello")
    sheet1.AddCell(cell)
  
    cell.InitializeText(2, 0, "Goodbye")
    sheet1.AddCell(cell)

newWorkbook.write

End Sub

It created the file in dirrootexternal ok, but with 0 bytes and the file format wasn't recognized. I wasn't able to open it up.

I've got all 3 library files in the library folder.

I was going write some cells into an excel file and then attach it to an email.
 
Last edited:

Cebuvi

Active Member
Licensed User
Longtime User
Hi,

I'm testing the example of Excel library and I get this error

B4A version: 5.00
Parsing code. (0.01s)
Compiling code. (0.02s)
Compiling layouts code. (0.00s)
Generating R file. (0.11s)
Compiling generated Java code. (0.87s)
Convert byte code - optimized dex. (0.60s)
Packaging files. (0.26s)
Copying libraries resources (0.02s)
Found 7 resource files.
Signing package file (private key) (0.52s)
ZipAlign file. (0.07s)
Installing file to device. Error
pkg: /data/local/tmp/ExcelExample.apk
Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

Where is the problem?

Thanks

PROBLEM SOLVED. there was another app with the same name.
 
Last edited:

ilan

Expert
Licensed User
Longtime User
is it possible to add to a specific cell a link to a different sheet??

like i have 3 sheets in my excel file and i want to click on cell 0,0 in sheet1 to open sheet2

is it possible to create such a excel file with this lib?

thanx
 

ilan

Expert
Licensed User
Longtime User
You can create a template Excel workbook with this link and then read the template, add your data and save it as a new workbook.

Thanx erel, this is a good idea.

So from your answer i also understand that i cannot create such a cell (that will link to a specific sheet) unless i have create by myself the excel file and just change the content i want, right?
 

merlin2049er

Well-Known Member
Licensed User
Longtime User
That doesn't seem to hard, just split your strings up and then write them each into to an separate excel cell.
 
Last edited:

wonder

Expert
Licensed User
Longtime User
I have a small app that does the following:
- Import Excel data into SQLite DB
- Process the data through MySQL
- Export back into an .xls file

The problem is that I have some hyperlinks in the original .xls file which are lost in the process.
Is it possible to retrieve the hyperlinks from the original and add them back in the output file?
 

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Really, I want to export SQL results that I've realiced to sqlite file and to export to xls. It's possible to see your app??
 

wonder

Expert
Licensed User
Longtime User
Really, I want to export SQL results that I've realiced to sqlite file and to export to xls. It's possible to see your app??
Sure!
Only I don't have access to the computer where it's stored right now.
I'll send you the code by Monday.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…