B4J Question (Solved)[B4X] Localizator Tool - strings.db -> strings.xlsx

aeric

Expert
Licensed User
Longtime User
Refer to this tutorial

Erel has provided a tool to convert the Excel file to SQLite file.
SS-2016-07-07_17.21.20.png


My mistake that I have manually created the strings.db file without the strings.xlsx file.

Now I am thinking to organize the file and check if I have missed any item.
Anyone have created a similar tool to convert the string.db back to strings.xlsx file?
Mind to share here?
If I have missed any thread with the solution, please point me to the post. Thanks.
 

Magma

Expert
Licensed User
Longtime User
Refer to this tutorial

Erel has provided a tool to convert the Excel file to SQLite file.
SS-2016-07-07_17.21.20.png


My mistake that I have manually created the strings.db file without the strings.xlsx file.

Now I am thinking to organize the file and check if I have missed any item.
Anyone have created a similar tool to convert the string.db back to strings.xlsx file?
Mind to share here?
If I have missed any thread with the solution, please point me to the post. Thanks.
DB Browser for SQLite have export as csv, json

 
Upvote 1

aeric

Expert
Licensed User
Longtime User
Yes, I can copy and paste to Excel too.
I also ask ChatGPT to help me convert the file.
I am wondering if anyone already created such tool so it is more convenient with 1 click of a button.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
You mean the column width ? (This is something you must decide if you wanna do automatically)

here another version get all table names -> turn them all sheets:

B4X:
Public Sub ExportTablesToXLSX(dbPath As String, dbfilename As String, exportfilename As String)

    
    ' Δημιουργία κενού workbook
    Dim Workbook As XLWorkbookWriter = xl.CreateWriterBlank



    Dim SQL2 As SQL
    SQL2.InitializeSQLite(dbPath,dbfilename,  False) ' True για read-only
            
    ' Λήψη των table names
    Dim rs2 As ResultSet = SQL1.ExecQuery("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'")

    Do While rs2.NextRow
    
    
    ' Δημιουργία sheet
    Dim sheet As XLSheetWriter = Workbook.CreateSheetWriterByName(rs2.GetString("name"))

    Dim rs As ResultSet = SQL1.ExecQuery("SELECT * FROM " & rs2.GetString("name"))
    ' Γράφουμε τα ονόματα των πεδίων ως τίτλους στη πρώτη σειρά
    Dim colCount As Int = rs.ColumnCount
    For col = 0 To colCount - 1
        sheet.PutString(xl.AddressZero(col, 0), rs.GetColumnName(col))
    Next

    ' Γράφουμε τις γραμμές δεδομένων
    Dim rowIndex As Int = 1
    Do While rs.NextRow
        For col = 0 To colCount - 1
            sheet.PutString(xl.AddressZero(col, rowIndex), rs.GetString2(col))
        Next
        rowIndex = rowIndex + 1
    Loop

    rs.Close
    
    Loop

    ' Αποθήκευση του αρχείου
    Workbook.SaveAs(dbPath, exportfilename, True)
    

End Sub
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Time for dinner.
When I free, I will add the function for 2-way conversion. :)
 
Upvote 0
Top