The Excel2SQL tool can be used to automatically upload one or more files to SQL Server.
Alternatively and offering more flexibility is using the
pre-built Jupyter notebook file, this can be found in the same
directory as the executable.
Although the Jupyter version offers more flexibility, it
requires the Python and modules listed in the Technical
Detail section.
Both the Excel2SQL.exe and the Jupyter notebook predominantly use the data.sql module class. This can be accessed as a normal Python module by following the instructions in the data.sql documentation.
To use the Excel2SQL Jupyter or the modules used by Excel2SQL, the following Python and Python module versions should be installed.
The excel2sql.py file is the compiler target. Firstly, before compiling, the following lines in the excel2sql.py file should be commented out.
import sys
The executable program is compiled using
Pyinstaller.
Documentation on the following Pyinstaller arguments can be
found
here. When compiling the following modules must be
included using --hidden-import
Alongside this, there are several modules that should be excluded using --exclude-module, examples include;
To include the custom modules the libraries directory must be specified using --paths. The final compile cmd window script should look something like:
pyinstaller -F --onefile --hidden-import pandas --hidden-import os.path --hidden-import datetime --hidden-import pyodbc --exclude-module=scipy --exclude-module=matplotlib --exclude-module=PyQt5 --paths="C:/pysqlplus/lib" excel2sql.py
Once this has been complete, an excel2sql.spec file is generated. This can be used for future compiling. To use this, open the file in a text editor to modify parameters, then type pyinstaller excel2sql.spec into the cmd window terminal.