Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Import data from excel file to sqlite database using Qt C++



  • Hello,
    I have an excel file in my local storage which is of almost 2 MB. I want to create a relational database and want to import the data from the excel file to the database using C++.Is there any way to do this??Can anyone help me with this?



  • @Sini
    You need to start by knowing what the data in the Excel file and how you want to map it to a relational database. Or do you just mean every line in the Excel file is to map to a row in a single table in the database?



  • @Sini said in Import data from excel file to sqlite database using Qt C++:

    want to import the data from the excel file to the database using C++

    If it's a one-of then I'd advise against it. It's much easier and faster to just use excel to build your query strings and dump them in an editor.
    If it's a recurring thing then you can read excel files using one of the methods listed here and just use the QtSql module to get them into SQLITE



  • @JonB The file includes CAN signals and it has more than 60 columns and almost 5000 rows. I want to make multiple tables (two to three ) with foreign key reference since the file has many signal datas for a single id.



  • @Sini
    So I don't know what to say other than you'll need to write code to read/parse it and create tables, relationships and rows as required.


Log in to reply