How to put a Word/Excel file into a database



Hi everyone,

I have data coming to me in the form of Word and Excel files, and I
need to place this data into a SQL Server database. The Word file will
be coming in text which is similiar to an Excel sheet, but instead of
being comma delimited, it will be delimited by spaces. Regarding the
Word document, I can set rules for the field length myself, but my
question is regarding the proper programming APIs to use. Can this be
done via VB scripts on the documents, or as a seperate .NET
application? I have access to both the C# and VB.NET platforms. (And
J2EE as well, although a Microsoft platform would be more appropriate,
IMHO). Any ideas on the best way to do this?



You are saying "Word and Excel" but then you are descibing delimited text
files that would need to be imported into either Word or Excel in order to
become real Office application documents (e.g. ".doc" and ".xls" files). So
you are really desribing two issues.
1) To import delimited text into either Word or Excel you would need to use
the respective Primary Interop Assembly for that office application.
2)regarding storing in the database, text can always be stored in a TEXT or
NTEXT column. "Real" Word or Excel files are binary and so would need to be
stored in am Image type column.
Hope that helps.


Hi Peter,

We don't need the file itself in the database, we need the text in the
file itself. It would be easier to get it as pure text, but our
customer sends the data to us in Word and Excel, and there's no way we
can change that. But it sounds like the Primary Interop Assembly could
be used to output the data in a Word or Excel to a .txt and .csv file
respectively? If that could be done, then it could solve our issues.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question