简体   繁体   中英

Import Excel files to SQL Azure, within Azure

I have read questions like this (Is Jet.OLEDB supported in 64bit?) and this (requires on-premise MSSQL) in SSO, but I have not come across the right solution that suits me.

I have some excel files (xlsx) in an Azure VM and I want to push all of these to the SQL Database in Azure. This would be a repetitive task, (files come in from a source and have to pushed to DB) - required to be executed on a daily basis.

I am planning to use this approach -

Current Solution -

Custom code : A .NET app that uses OpenXML SDK/NPOI/EPPlus to read the files and manually push them to SQL Database (using .Net SQLBulkCopy). App runs within the VM.

The problem with the above approach is that - it requires time to code and test with excel files of varying schema. I am looking to see if there other options that could avoid custom code. Please note that there is no on-premise involvement here (So I presume no SSIS, no BCP(?) etc). This is not a one-time migration kind of activity.

Other Options?

1) Access Database Engine? : Can the "Access Database Engine" ( 2010 or 2013 ?) be used to get read the excel files rather than openXML or other tools? It appears to be an alternate to the Jet.OLEDB in a 64 bit environment. But I am unsure if this support excel 2007 formats as well and why would you choose this vs OpenXml SDK/NPOI/EPPlus if the job is just to read the excel file (no creation, manipulation)

2) BCP in Azure? : Can BCP used WITHIN azure? Not quite sure about this. If so, would it make sense to convert XLSX to CSV and then use BCP to upload to SQL Database, thereby minimize the amount of code I have to write?

3) ExcelDataReader? : If custom code is the option, can the ExcelDataReader which is cross-platform (and I don't need cross platform capability) and supports both XLS and XLSX. ExcelDataReader is said to be faster - but unsure how faster is it when compared to reading files using OpenXML SDK or tools like NPOI/EPPlus

Appreciate thoughts from the community.

from my experiences, option 2 would be the most pragmatic. It is a matter of preference/familiarity whether you want to open the Excel documents with a library like ExcelDataReader or programmatically convert the file first to CSV and read as a delimited file. Either way, BCP is relatively straightforward way to get data into SQL Database using custom code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM