Read Excel file from Document Libray on to webpart
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Read Excel file from Document Libray on to webpart

 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development
Author Message
Ajay Kumar
Guest





Posted: Tue Jan 11, 2005 9:01 pm    Post subject: Read Excel file from Document Libray on to webpart Reply with quote

Hi all,

Can any one tell me how to pull data from excel file which is in Document
Library .

There will be a web part code whic will call this excel file data from
document libaray .

Please send me a sampel code for the same.

Wating urgently .

Thanks in advance.

Ajay kumar
Back to top
Tariq
Guest





Posted: Wed Jan 12, 2005 10:56 am    Post subject: Re: Read Excel file from Document Libray on to webpart Reply with quote

What exactly do you want to do?

If you want to show the contents of the XL file on a webpart page, you
can use the pageviewer or webcapture webparts.

If you want to get a little more complex you could save the excel file
in a document library as xml, and the use the Xml WebPart with a XSLT
to render it.

If you want to to access the excel file in a document library, the code
is pretty straing forward.
get an SPWeb instance of the site you are in from the portal context,
then access the document library via the SPWeb object, and from the
document library get the item you want.

The following discussion has code that might help you
http://www.sharepointu.com/forums/Moving_Documents_between_Libraries/m_17007/tm.htm
- Tariq
Back to top
Ajay Kumar
Guest





Posted: Wed Jan 12, 2005 10:41 pm    Post subject: Re: Read Excel file from Document Libray on to webpart Reply with quote

Tariq thanks for replying back.

Quote:
What exactly do you want to do?

I have created a document library which is based on excel based template.
so the user will created a new excel document and will enter some value
into the excel sheet and save this excel as file1.xls type not any other
type ( I will be using only xls type file not any other type such as xml ,
or any spreadsheetxml as some vba coding is done on the excel template
file). so user will be saving many excel file of type excel (xls type only).

Now my problem is how to get the data from each excel file here file1.xls ,
file2.xls .
I can get the name of excel file from document library by either using
sharepoint webservice or using dll i.e. SPWeb etc.

My problem is after that i got the name of the file then how to get each
excel file informations.

Can you please provide some sample code to get the information of file.xls.

As excel file is stored into the database of the sharepoint

Do we need to create excel object and use excel object model in the code.
but this too will not work.

Please provide me a way to the solution.

Needed the solution badly.

Thanks in advance.

Ajay kumar



"Tariq" wrote:

Quote:
What exactly do you want to do?

If you want to show the contents of the XL file on a webpart page, you
can use the pageviewer or webcapture webparts.

If you want to get a little more complex you could save the excel file
in a document library as xml, and the use the Xml WebPart with a XSLT
to render it.

If you want to to access the excel file in a document library, the code
is pretty straing forward.
get an SPWeb instance of the site you are in from the portal context,
then access the document library via the SPWeb object, and from the
document library get the item you want.

The following discussion has code that might help you
http://www.sharepointu.com/forums/Moving_Documents_between_Libraries/m_17007/tm.htm
- Tariq

Back to top
Tariq
Guest





Posted: Thu Jan 13, 2005 1:26 pm    Post subject: Re: Read Excel file from Document Libray on to webpart Reply with quote

Hi Ajay,

Question: Do you want to extract the data in the various columns in the
document library for each excel file, or do you want to extract data
from the Excel file itself?

If you want to extract data from the Excel file itself, first download
the file to a temporary location from SharePoint and then this should
give you a start
http://groups-beta.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/1a1d477afae6491f/2f8ba62f6f4d64b6?q=accessing+excel+csharp&_done=%2Fgroups%3Fq%3Daccessing+excel+csharp%26hl%3Den%26lr%3D%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#2f8ba62f6f4d64b6

If you want to access the data stored within the columns in the
document library for each excel file you have to obtain an SPList
object for the document library, then get the SPList item corresponding
to the excel file, and then you could access the columns as
listItem["Column Name"]


- Tariq
Back to top
Ajay Kumar
Guest





Posted: Thu Jan 13, 2005 10:41 pm    Post subject: Re: Read Excel file from Document Libray on to webpart Reply with quote

Hi Tariq,

Once again thanks for replying back.

As you had mentioned

If you want to extract data from the Excel file itself, first download
Quote:
the file to a temporary location from SharePoint


Yes i am using this approach for extacting data from excel file.

As i am using asp.net applicaton where i am displaying the extracted
information in ascx file .

But when i am calling to this file using url as
http://servername:8083/sites/sitename/dcoument libary name/file1.xls it gives
me error message as invalid internet address . but if we try through
windows app it would work.

so my question is how to extact excel information into asp.net (ascx file)
.. This will be finally called in a webpart and displayed in the sharepoint
webpart page.

Can you provide me some sample code or way to my problem


Please help me !!


Thanks in advance.


Ajay kumar








"Tariq" wrote:

Quote:
Hi Ajay,

Question: Do you want to extract the data in the various columns in the
document library for each excel file, or do you want to extract data
from the Excel file itself?

If you want to extract data from the Excel file itself, first download
the file to a temporary location from SharePoint and then this should
give you a start
http://groups-beta.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/1a1d477afae6491f/2f8ba62f6f4d64b6?q=accessing+excel+csharp&_done=%2Fgroups%3Fq%3Daccessing+excel+csharp%26hl%3Den%26lr%3D%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#2f8ba62f6f4d64b6

If you want to access the data stored within the columns in the
document library for each excel file you have to obtain an SPList
object for the document library, then get the SPList item corresponding
to the excel file, and then you could access the columns as
listItem["Column Name"]


- Tariq

Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB