Answered by:
Creating Excel using Excel Services

Question
-
Hi,
I am new to MOSS. I got this requirement. Please let me know whether this is feasible using Excel WebServices.
Whenever a new item is added to a particular list, I need to read an excel file from a shared location(this file is a template).
Based on this template Create a new excel file and populate the newly added data and save it in another shared location.- Edited by A.m.a.L Hashim Friday, September 11, 2009 10:23 AM from
- Edited by Mike Walsh FIN Monday, November 9, 2009 4:34 PM sig removed. please change it. DO NOT ask people to mark your post
Friday, September 11, 2009 10:15 AM
Answers
-
If the excel file is in 2007 open xml format (.xlsx), then yes, you can do this a few ways.
First, make sure your library used to hold the generated excel documents is a trusted location for excel services to access (this is in central admin).
Second, your code can easily copy the template file from one shared location into another shared location when an item is created. Do this in an event handler that runs on the ItemCreated event on your list.
Once the template file has been copied, you can open it using excel services and update the cells.
Alternatively, you can use the Open Xml Sdk (v1 or v2, though I really like v2: http://www.microsoft.com/downloads/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0), or ExcelPackage : http://excelpackage.codeplex.com/ to modify the files.
Unless you want to render excel into the browser, these other options may work out better for you.
A few quick google searches will show you how to open and copy files from one doclib to another, set up event recievers, and manipulate excel documents using the methods descibed above.- Proposed as answer by Pablo Gazmuri Friday, September 11, 2009 7:32 PM
- Marked as answer by Chengyi Wu Monday, September 14, 2009 12:56 AM
Friday, September 11, 2009 7:32 PM -
Hi,
You don't have to use Excel Services, Open XML is a better approach, and does not require MOSS 2007 Enterprise license.
Peter- Marked as answer by Chengyi Wu Monday, September 14, 2009 12:56 AM
Friday, September 11, 2009 7:38 PM
All replies
-
If the excel file is in 2007 open xml format (.xlsx), then yes, you can do this a few ways.
First, make sure your library used to hold the generated excel documents is a trusted location for excel services to access (this is in central admin).
Second, your code can easily copy the template file from one shared location into another shared location when an item is created. Do this in an event handler that runs on the ItemCreated event on your list.
Once the template file has been copied, you can open it using excel services and update the cells.
Alternatively, you can use the Open Xml Sdk (v1 or v2, though I really like v2: http://www.microsoft.com/downloads/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0), or ExcelPackage : http://excelpackage.codeplex.com/ to modify the files.
Unless you want to render excel into the browser, these other options may work out better for you.
A few quick google searches will show you how to open and copy files from one doclib to another, set up event recievers, and manipulate excel documents using the methods descibed above.- Proposed as answer by Pablo Gazmuri Friday, September 11, 2009 7:32 PM
- Marked as answer by Chengyi Wu Monday, September 14, 2009 12:56 AM
Friday, September 11, 2009 7:32 PM -
Hi,
You don't have to use Excel Services, Open XML is a better approach, and does not require MOSS 2007 Enterprise license.
Peter- Marked as answer by Chengyi Wu Monday, September 14, 2009 12:56 AM
Friday, September 11, 2009 7:38 PM -
A further simpler approach would to build the excel xml string. Save the excel file (.xls or .xlsx) in xml format to understand the schema.
Thanks Guru Karnik,RegardsPrasad
Can you elaborate a bit more.- Edited by Mike Walsh FIN Monday, November 9, 2009 4:35 PM sig removed. please change it. DO NOT ask people to mark your post
Saturday, September 12, 2009 6:52 AM -
Thanks Pablo for this wonderful description. Sure I am going to try all the above mentioned ways.
- Edited by Mike Walsh FIN Monday, November 9, 2009 4:35 PM sig removed. please change it. DO NOT ask people to mark your post
Saturday, September 12, 2009 6:53 AM -
Thanks Peter for your support.
- Edited by Mike Walsh FIN Monday, November 9, 2009 4:35 PM sig removed. please change it. DO NOT ask people to mark your post
Saturday, September 12, 2009 6:54 AM