Connecting to CSV Files
The SaveToDB add-in allows you to connect to CSV files using two wizards:
This section covers the first method, which utilizes OLEDB providers and ODBC drivers.
The SaveToDB add-in supports the following data providers:
- Microsoft Access Text Driver
- Microsoft.Jet.OLEDB.4.0 (32-bit only)
- Microsoft.ACE.OLEDB.12.0
- Microsoft.ACE.OLEDB.16.0
Below is a sample of the Database Connection Wizard page where you can select the data provider:
In the next step, choose a folder (or a file):
You can click the Properties button to edit the connection properties.
Next, select a CSV file to connect:
Microsoft CSV data providers require a schema.ini
file in the same folder as the source file. The file should define the structure like this:
[MsnMoneyQuotes.csv] ColNameHeader=True Format=Delimited(;) MaxScanRows=100 CharacterSet=ANSI Col1=LoadDate DateTime(yyyy-MM-dd) Col2=LoadTime DateTime Col3=MarketDate DateTime(yyyy-MM-dd) Col4=MarketTime DateTime Col5=Symbol Text Col6=MsnSymbol Text Col7=Bid Double Col8=Ask Double Col9=BidSize Integer Col10=AskSize Integer Col11=Open Double Col12=High Double Col13=Low Double Col14=Last Double Col15=Volume Integer
The SaveToDB add-in generates these definitions for you by analyzing the file contents.
You can manually adjust the generated definitions. For more details, refer to https://learn.microsoft.com/en-us/sql/odbc/microsoft/schema-ini-file-text-file-driver?view=sql-server-2017.
For files encoded in UTF-8, use the following value:
CharacterSet=65001