Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Saving excel sheet on server machine

  Asked By: Sophie    Date: Feb 04    Category: Sharepoint    Views: 1146

My question is it possible to save excel and image file on d drive of server
throught web part usiingobject model and also read it

My scenario is
I want to create chart by reading excel file through web part.The excel file is
stored in one of document library.To read excel file i am using ado.net .
But in connection string in datasource it requires absolute path for that i need
to save the file on server and then again read it from there.
Same is case in image

Can this be acheived ,if not is there any work around



2 Answers Found

Answer #1    Answered By: Shushma Zariwala     Answered On: Feb 04

You could always map a network drive  to the document  library using the
\\server\path\ and use the mapped drive path  as your file  location for the data

Answer #2    Answered By: Bahadur Kotoky     Answered On: Feb 04

But i am still confused how to do that
Please see the attached code and advice me how to do it.Also instead of using it
this way can i directly read  the excel  sheet from document  library

string selValue= "sites/"+"Motorola";

spGlobalAdmin = new SPGlobalAdmin();

SPVirtualServer virtualServer = spGlobalAdmin.OpenVirtualServer(new

SPSiteCollection collections = virtualServer.Sites;

SPSite site =collections[selValue];

foreach(SPWeb web  in site.AllWebs)


if(web.Name =="Reports")


SPWeb reportweb= site.AllWebs["Reports"];

SPFolderCollection folders= reportweb.Folders;

foreach(SPFolder folder in folders)


if(folder.Name == FolderList.SelectedItem.Value)


SPFolderCollection subfolders = folder.SubFolders;

foreach(SPFolder subfolder in subfolders)


SPFile file  = subfolder.Files[ExcelList.SelectedItem.Value];

FileInfo fileinfo = new FileInfo(file.Url);







Didn't find what you were looking for? Find more on Saving excel sheet on server machine Or get search suggestion and latest updates.