From excel to sqlite

Input file

Our API accepts one or multiple Excel .XLSX files as input.

Max file size for web uploads: 50 GB
Register to upload big files via Amazon S3.

Output file

The API will return a ZIP archive that contains a .SQLITE database file.

Conversion methods

Using our Java tool

Download the

RebaseData client Java tool
.
To convert your database using RebaseData, run the following command:

                    java -jar client-0.0.5.jar convert --output-format=sqlite file.xlsx output-dir/
                

Using CURL

Replace file.xlsx with the path to the Excel file you want to convert.

The file output.zip will contain a .SQLITE file with your data or the error message if something went wrong.

curl -F files[]=@file.xlsx 'https://www.rebasedata.com/api/v1/convert?outputFormat=sqlite&errorResponse=zip' -o output.zip

How long does it take?

The conversion process takes between 15 seconds and multiple minutes. It depends on the size of the database.

You can also use your favourite tool

  • Read Excel using PHP
  • Read Excel using Python
  • Read Excel using Ubuntu

Why use RebaseData?

  • Strong security.
  • Convert online without installing Microsoft Excel.
  • Works with Windows, Mac and Linux.
  • Use an API to convert your databases.
  • Professional support.

Terms

  • We don’t guarantee for the success or correctness of the conversion
  • You are only allowed to convert your own database files
  • By using RebaseData, you agree to our general terms

The ESF Database Migration Toolkit is a robust and efficient solution for migrating data between various database formats, including MS Excel and SQLite.

This guide will show you how to easily migrate data from MS Excel to SQLite through a few simple steps of a wizard, streamlining complex migration processes and saving you valuable time.

Software Required:

DMToolkit_x64.zip
(60.9 MiB)
64-bit Windows application for ESF Database Migration Toolkit 11.1.23 (2023-04-07).
(md5: ba7fbaa2a70183bfab1276b3790b51c8)
DMToolkit_win32.zip
(57.4 MiB)
32-bit Windows application for ESF Database Migration Toolkit 11.1.23 (2023-04-07).
(md5: 50677956511509d1e6bd99f3eb215fb1)

System Supported:

  • Windows 7 or higher.
  • MS Excel 97 or higher.
  • SQLite 2 or higher.

Introduction:

1. In «Choose a Data Source» dialog, Choose «Microsoft Excel(*.xls;*.xlsx)»;

  • Click on the «…» button.
  • Choose the Microsoft Excel (.xls or .xlsx) file that you want to use as the destination for the migrated data.
    Microsoft Excel

2. In «Choose a Destination» dialog, Choose «SQLite»;

  • Click «…» button to select the SQLite database file.
    SQLite

3.In «Select source Tables(s) & View(s)» dialog;

  • Select the tables or views you want to migrate.
    Select Tables&Views
  • You can access the table options or adjust the table structure by clicking the «…» button.
    Transform
  • In the «Field Mapping» option, you can customize the destination table’s fields, such as field name, data type, default value, comment, and more. You also have the option to choose the data transfer method, including Overwrite Table, Empty Data, Append Data, or Skip Table, or even filter the data before transferring it.

4. In «Execution» Dialog;

  • You can start the migration process by clicking «Submit». The toolkit will efficiently and seamlessly migrate your data from MS Excel to SQLite without the need for manual intervention.
    Execute
  • To keep track of the migration process, you can access the full migration log by clicking «Browse Log». This will provide you with a comprehensive view of the entire migration, including any potential issues and their resolutions.
  • To save time in the future, you can save the migration settings as a job file by clicking «Save as job». This allows you to quickly reload the migration job at a later time or run the migration job using the command-prompt by typing «dmtc.exe —help». The command-prompt provides you with a full list of parameters to customize the migration process to your specific needs.

5.Finished!

Upon completion, the toolkit will generate a comprehensive migration report, providing you with all the information you need to verify the accuracy and completeness of the migration process. So, you can sit back and relax while the program carries out the task efficiently. Should you have any inquiries or recommendations, don’t hesitate to reach out to us. We’re always happy to help.

Download Now »

Related Links:

Upload your Excel File and Convert

Drag & Drop files here…

Please note that your data will not be shared to anybody unless you do it yourself.

Conversion from Excel to SQLite

Upload your Excel data (widely used in software like MS Excel) and convert them by one click to SQLite (SpatiaLite) format (widely used in software like SQLite Database).

Notice to Excel format — Detection of columns containing coordinates is based on attribute name — please rename columns containing coordinates to any of these: x, xcoord, xcoordinate, coordx, coordinatex, longitude, long (and of course: y, ycoord, ycoordinate, coordy, coordinatey, latitude, lat). If you have geometry as WKT or WKB, use wkt or wkt name for the geometry column name.


About MyGeodata Converter

Our online converter of Microsoft Excel format to SQLite / Spatialite RDBMS format (Excel to SQLite) is fast and easy to use tool for both individual and batch conversions. Converter also supports more than 90 others vector and rasters GIS/CAD formats and more than 3 000 coordinate reference systems. If the coordinate system of your input data is not present or not recognized correctly, it is possible to assign the correct one. Then it is possible to transform your data to any other coordinate reference system.

Files can be uploaded using multiple selections or packed into any supported format (ZIP, RAR, 7Z, TAR, GZIP). If the input format is directory-based, it is necessary to pack whole directory — not only the content.

To avoid considerable servers loads we had to set conversions limits for each user — please see Free plan. If you exceeded the limit, you may register a prepaid plan — otherwise you will be charged by credit card during the conversion process (one-off payment). Your charges allow us to cover costs associated with the servers operation and to improve our service.

Supported coordinate reference systems

MyGeodata Converter supports more than 3 000 coordinate systems — including:

  • WGS 84
  • ETRS89 / LAEA Europe
  • ETRS89 / UTM zone 30N (N-E)
  • ETRS89 / UTM zone 29N
  • MGI / Austria Lambert
  • GDA94 / MGA zone 54
  • GDA94 / MGA zone 55
  • RGF93 / Lambert-93
  • WGS 84 / UTM zone …
  • ED50 / TM27
  • Amersfoort / RD New
  • Pulkovo 1942 / Gauss-Kruger
  • S-JTSK / Krovak
  • NAD27
  • NAD83

  • Pseudo-Mercator, Spherical Mercator, Google Maps, OpenStreetMap, Bing
  • OSGB 1936 / British National Grid — United Kingdom Ordnance Survey
  • … and 3 000+ other coordinate reference systems

Excel-to-sqlite

Convert excel documents to sqlite!

Dependencies

  • Sqlite3: 5.0.0
  • Xlsx: 0.16.4

Documentation / usage

Navigation

  • Main
    • Loading your excel
    • Sheet names
    • Read One Sheet
      • Get sheet data
      • Save sheet to sqlite
    • Read All Sheets
      • Get data of all sheets
      • Save whole excel
    • _xlsx

Firstly, load the package.

const excelToSqlite = require("excel-to-sqlite");

The export of excel-to-sqlite is one function, with one parameter: excelPath.

Loading your excel

The path must me absolute, like __dirname. This example uses path.

const path = require("path");
let excelPath = path.join(__dirname, "test.xlsx"); // File "test.xlsx" in the current directory
let excel = excelToSqlite(excelPath);

Sheet names

After you used the excelToSqlite function, you can use the property sheets to get a string array of all the sheet names.

let sheets = excel.sheets;
console.log(sheets);

Read One Sheet

To read one sheet, use the method readSheet afer you used the excelToSqlite function. It has one parameter: The name of the sheet.

The name of the sheet is case-sensitive!

let sheet = excel.readSheet("Sheet1"); // Read "Sheet1".

Data

To get the data of the current sheet, use the property data on sheet.

To get the json data, use the method getJSON.

let json = sheet.getJSON();

Output

[
  Sheet1: [
    {column_1_name: "value", column_2_name: "value", ...},
    {column_1_name: "value", column_2_name: "value", ...}
  ]
]

Save sheet to SQLITE

To save the current sheet to sqlite, use the saveTo method. It has one parameter: The name of the sqlite file.

Warning: When saving to a database, a table with the same name as the current sheet will get deleted.

To change the name of the table in the sqlite database, set sheet._name to another string before calling the saveTo function.

This function returns a promise, that will be resolved with a database object of sqlite3.

// Save without changing the name
sheet.saveTo("database.sqlite").then((database) => {
  console.log(`Sheet ${sheet._name} saved in "database.sqlite"!`);
});

// Change the name for the table and then save
sheet._name = "lol";
sheet.saveTo("database.sqlite").then((database) => {
  console.log(`Sheet ${sheet._name} saved in "database.sqlite"!`);
});

Read All Sheets

To read all the sheets in an excel, use the readAll method.

let sheets = excel.readAll();

Data

To get all the data of all the sheets, use the property data. To convert your data to JSON, use the method getJSON.

let data = sheets.data;
let json = sheets.getJSON();

Output:
See Output

Saving Whole Excel

To save the whole excel in sqlite, use the saveTo method. It has one parameter, the name of the database.

This function returns a promise, that will be resolved with a database object of sqlite3.

Warning: When saving to a database, a table with the same name as a sheet will get deleted.

sheets.saveTo("database.sqlite").then((database) => {
  console.log("Whole database saved in sqlite!");
});

_xlsx

The property _xlsx is the output of xlsx.readFile.

Try this fresh code exceltosql:

'''
This code uses the openpyxl package for playing around with excel using Python code
to convert complete excel workbook (all sheets) to an SQLite database
The code assumes that the first row of every sheet is the column name
Every sheet is stored in a separate table
The sheet name is assigned as the table name for every sheet
'''

import sqlite3
import openpyxl
from openpyxl import load_workbook
import re

def slugify(text, lower=1):
    if lower == 1:
        text = text.strip().lower()
    text = re.sub(r'[^w _-]+', '', text)
    text = re.sub(r'[- ]+', '_', text)
    return text

#Replace with a database name
con = sqlite3.connect('test.db')
#replace with the complete path to youe excel workbook
wb = load_workbook(filename=r'abc.xlsx')

sheets = wb.get_sheet_names()

for sheet in sheets:
    ws = wb[sheet] 

    columns= []
    query = 'CREATE TABLE ' + str(slugify(sheet)) + '(ID INTEGER PRIMARY KEY AUTOINCREMENT'
    for row in ws.rows[0]:
        query += ', ' + slugify(row.value) + ' TEXT'
        columns.append(slugify(row.value))
    query += ');'

    con.execute(query)

    tup = []
    for i, rows in enumerate(ws):
        tuprow = []
        if i == 0:
            continue
        for row in rows:
            tuprow.append(unicode(row.value).strip()) if unicode(row.value).strip() != 'None' else tuprow.append('')
        tup.append(tuple(tuprow))


    insQuery1 = 'INSERT INTO ' + str(slugify(sheet)) + '('
    insQuery2 = ''
    for col in columns:
        insQuery1 += col + ', '
        insQuery2 += '?, '
    insQuery1 = insQuery1[:-2] + ') VALUES('
    insQuery2 = insQuery2[:-2] + ')'
    insQuery = insQuery1 + insQuery2

    con.executemany(insQuery, tup)
    con.commit()

con.close()

Понравилась статья? Поделить с друзьями:
  • From excel to spss
  • From excel to sas
  • From excel to pie chart
  • From excel to phpmyadmin
  • From excel to pdf mac