SharePoint 2010: Evenreceiver to read data from excell file

Hello. I used this to create event receiver that read value from uploaded excel file.

I have two problems:

1) My test account or elevated privilleges cannot create ApplicationClass myThing = new ApplicationClass(); Error: Retrieving the COM class factory for component with CLSID {X} failed due to the following error: 80070005. Seems like access denied problem. I need to enable site members to upload excel documents.

2) Excel proces never ends (Task manager).

So, how can read excel values properly?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
my advice is NOT to use any "custom" type of COM components due to
- issues in security / configuration
- memory leaks / unpredicted behavior on the server

Which type/format of Excel will the user upload? Office 2007/2010 format (XSLX) ?
Does the uploaded file always look the same (hence some kind of template)?

If it is the "new" format I would use the plain .NET Open XML SDK:

How to read Excel Cell values:

Very good tool which generates already the code is part of the SDK: Open XML SDK v2.0 Productivity Tool for Office

If necessary/possible I would like to help you further - can you explain what you want to achieve and could you perhaps attach a sample Excel file?

Thanks and HTH
tolppaAuthor Commented:
Thanks.  I keep this question open until some more testing but open XML seems to be easy way to do this. Unortunately I still need to instal OpenXMLSDKv2 to my server, but I  guess this cannot be helped.
Rainer JeschorCommented:
afaik you do not need to install the sdk on the server, you just need to deploy the referenced .net dlls and add them ti your Sharepoint solution and then deploy them to the GAC. If you need assistance just add a comment and I will help.
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

tolppaAuthor Commented:
Thanks and sorry for delay (again). Seems easy enought to do ( but how can I know the assemply info:

        <SafeControl Assembly="X, Version=, Culture=neutral, PublicKeyToken=X" Namespace="XXXX" TypeName="*" />
Rainer JeschorCommented:
this depends on the version of Office XML you have installed.
The easiest way to find the information is to just open the Global Assembly Cache (C:\Windows\Assembly) and look for the entry:

There you can find both the version info as well as the PublicKeyToken.

The entry should be:
<SafeControl Assembly="DocumentFormat.OpenXml, Version=2.0.5022.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="DocumentFormat.OpenXml" TypeName="*" />

Open in new window

but currently I can not verify/test this.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tolppaAuthor Commented:
The entry is correct. I checked the dll.  Seems like I have no problem with this.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.