SSIS packages processing data from an excel file - c#

I have a SSIS script that processes data from an Excel file coming from a third party. The only issue I have is there's a column with the customer's names in that file, and when a name contains a special character like ', the code will not process that file.
How could it be modified to allow a special character such as an aposthropy (')?

Related

Howto convert a hex string into a file (OOXML document)

I have a SQL Server 2008 database from an application which stores office file templates.
The files in the database are stored in hex format (0x504B030414000600...).
With a file signature table (https://www.garykessler.net/library/file_sigs.html), I can find out which file format it is: Microsoft Office Open XML Format Documents (OOXML, like DOCX, PPTX, XLSX ...).
How can I export/convert these hex strings into the original files?
Maybe with C# ...
With the application itself, I can only export 1 file at a time. It would take days to do this with all files (about 1000).
Thank you
Export column with files from SQL Server to single file (it may be very large, but it shouldn't matter). You can for example right click and export results to CSV file.
Write simple C# console application:
use CSV parser to loop over data
inside loop you can make simple if statements to determine document file format
in every iteration convert hex format to blob file and save it somewhere on your drive

Schema.ini file location

I have created some code that works for me using OLE Jet to load a CSV file. I use the schema file to specify delimiter characters that are not the default comma.
The problem I am having is that the schema.ini file appears to have to be placed in same folder as the source CSV. This is fine for a static location but I want to allow the user to browse to any folder to load a CSV file.
Where else can I place the schema.ini file in a scenario like this. I do not want to modify the registry in case it impacts other applications and from my research Jet does not allow the delimiter to specified in connection string.
Is there any way I can build this into the application?

How to read comma file (.csv) and tab separated file(.txt) by a single Flat File Source SSIS Data Flow Item?

I'm new to SSIS and in one of my project I need to read both comma separated file (.csv) and tab separated file (.txt) by a single Flat File Source. Unfortunately I cannot make .txt file content as comma separated because this is how it is generated by a separate source file providing system neither have an option to modify the file content before supply to SSIS. I'm expecting some help and support of your experience.

Automate the process of exporting data from multiple CSV files in a folder

I have already written a script to export data from a single CSV file into SQL Server. I do have to provide the path for that CSV.
I'm trying to figure out how do I modify the code so that it checks a particular folder for CSV files, and then starts processing them one by one. After processing each file, it moves the original file to a different location. Thanks in advance.
Update:
I have a console application written that parses the CSV, connects to SQL database and inserts values. But like I said I have to give the file path. I'm looking for a way to provide only a folder name and the application should look for any CSV files in that folder, parses each file, exports data to SQL, once done moves that file to a different folder and then starts with the next file.
For migrate data from csv try bulk insert
http://msdn.microsoft.com/ru-ru/library/ms188365.aspx
For example
bulk insert [tableName] from 'c:\test.csv'
With (
FIELDTERMINATOR =',',
FIRSTROW=1
)

Importing csv, tab delimited and excel files into c#

I'm developing an Excel import routine which is using OLEDB to read the file. Can I just reuse my code to do the same thing for csv and tab delimited files by just changing the connection string, and what would the strings be?

Categories

Resources