Asked by:
Reading excel data from SharePoint Document Library.

Question
-
Hi,
I have a requirement -
Have to read the excel data say e.g. col A,B,C data once the excel is added in the document library. Pull the contents(data) of the excel, which is uploaded in the doc libary and then store the fetched datas into the SQL table.
May I please know the possible solution to get the data of excel uploaded in the Document Library and the best approach to go with.
Is there any object model code to read the excel content(data) ?
Awaiting the response! Please help me out.
Thanks,
Niranjan
- Edited by Niran S Saturday, April 6, 2013 10:59 AM
All replies
-
InfoPath form is probably more suited for such scenarios. However, you can try writing an event receiver to read excel data using OpenXml APIs.
-
Hi Guru,
Thanks for the quick reply.
well I am quite new to the SharePoint. Just would like to know if the OpenXML Api will support reading the excel file from SharePoint Document Library.
Is this the perfect approach to go with?
I have to write the code in event receiver. How about using excel service?
- Edited by Niran S Saturday, April 6, 2013 6:41 PM
-
>Just would like to know if the OpenXML Api will support reading the excel
Yes, this will support.
>I have to write the code in event receiver.
If you are writing event receiver then use object model code to read excel. Here is some few threads with code for your ref:
http://www.sharepointwithattitude.com/archives/61
Hope it could help
Hemendra: "Yesterday is just a memory,Tomorrow we may never see"
Whenever you see a reply and if you think is helpful, click "
Vote As Helpful"! And whenever you see a reply being an answer to the question of the thread, click "
Mark As Answer
Please feel free to unmark answer if does not resolves your problem.
-
Hi Hemendra,
Thanks for the reply.
I am trying with the OLEDB connection way of accessing excel content, but I understand that it cannot read the file directly from SharePoint Document library. Rather we have to download it to the temporary loaction(file system) and then read the content/data from excel file.
Any other good approach to go for reading the excel content directly from SharePoint Library and then stroing the same content in SQL DB Table
I have used Interop.Excel dll and I could read the excel data correctly, now I need to store the result obtained to the SQL table.
- Edited by Niran S Monday, April 8, 2013 11:49 AM