Condividi tramite


First "Hello World" code sample with the Excel Services APIs!

Welcome to the new world of Excel Services in the Microsoft Office Sharepoint Server 2007 product line! During the next few months, I will be exploring the various programmability capabilities of Excel Services.

 

On this first post of many, we will make our first “Hello World” application that uses Excel Services to execute Excel 2007 Workbooks on the server. I will be using Visual Studio 2005 throughout my samples, but any language or tool that supports consuming web services will be able to achieve the same results.

 

Note that for the most part, my examples will be in C# - I will try to include VB.NET samples for most of these posts though. I will post the VB.NET equivalent of the sample in this post next monday.

Preparing the workbook for the sample

To begin, we will need a workbook. This will be our Hello World workbook and will contain a single cell (A1 of course) that contains the following:

A1: Hello

A2: Excel 2003

A3: =Concatenate(A1, " ", A2)

 

After creating this workbook, save it to your favorite Sharepoint Library or UNC and make sure Excel Services is aware of that location in its Trusted Locations list.

Creating the form and importing Excel Services API

Next, we will create a sample Win-Forms applications that will contain a single text-box control and two buttons. We will set the text on one button as “Get Default” and call it getDefaultButton and set the text on the other to be “Get Correct” and set the name to be getCorrectButton.

 

Our sample application will get the value in A3 when the getDefaultButton is pressed. However, when the getCorrectButton is pressed, it will change the value in A2 to the correct version of Excel and get the recalculated value in A3 (which will hopefully be “Hello Excel 2007”).

 

The last part of the needed preparation is to import the Excel Services API into our Visual Studio 2005 project. To do that, we will go to the Project/Add Web Services menu option. In the dialog that opens up, in the address text box we will enter:

https://<sharepoint server name>/_vti_bin/ExcelService.asmx?wsdl

Also, in the Web Service Name we will enter “ES” – this will be our namespace for all things Excel Services API from now on.

Finally, writing code to get information from Excel Services

Next, we are going to implement the code behind the Get Default button. The first step is to actually create the proxy object. We will place that object inside a using() statement since it implements the IDisposable pattern (note that neither the generated proxy class nor any of the classes it derives from actually do any real work in their dispose, but since the base class Component has a Finalizer, we will incur some unneeded perf degredation if we don’t dispose):

 

using (ES.ExcelService excelService = new ES.ExcelService())

{

       excelService.Credentials = System.Net.CredentialCache.DefaultCredentials;

}

So far so good – we created the proxy instance. This instance will allow us to actually make calls into Excel Services. Note that we set the credentials to be those of the user that is currently logged on to the machine – if we don’t do that, there’s a good chance the web server will deny us access to the web-service.

 

Next we will call into the server, requesting that it opens the workbook we saved. We will do that by calling into the OpenWorkbook() method. This method will try to open the workbook on the server – if it succeeds, it will return a session id that we will use to continue the communication with the server. The other parameters this method takes are the locales to use (I am leaving these empty for now – more on those at a later blog) and an out parameter that will contain status information on the operation (more on that in a later post as well):

 

using (ES.ExcelService excelService = new ES.ExcelService())

{

       excelService.Credentials = System.Net.CredentialCache.DefaultCredentials;

       ES.Status[] stati;

       string sessionId = excelService.OpenWorkbook(

              "https://MyServerName/Shared Documents/HelloWorld.xlsx",

              String.Empty, String.Empty, out stati);

}

 

If our call did not fail, it means we have a workbook waiting for us on the server. Next, we will get the value from cell A3 (the one that contains the formula). For that, we will add the following code below the OpenWorkbook() call:

 

       object o = excelService.GetCellA1(sessionId,

              "Sheet1",

              "A3",

              true,

              out stati);

 

As you can see, we pass the session id we got from the OpenWorkbook() call into the GetCellA1() call (the A1 in the name of the method denotes the way the method works – it can be used to get any cell from the workbook) – almost all the methods on the Excel web service require this first parameter. The second and third parameters are used to tell Excel Services what part of the workbook we want. In this case, we want cell A3 in Sheet1. The Boolean we pass as the fourth parameter tells Excel Services if we want the data returning to be formatted or not . The last parameter is the status array.  More on those parameters and on the various ways to get data from Excel Services in a future post.

 

The local variable o should now hold the string “Hello Excel 2003”.  There are two more things we need to do before we finish with this phase. The first is to place the value we got from the cell into the text box and the other is to close the workbook we opened. Note that Excel Services will timeout workbooks that are left opened on the server. To minimize wasted resources, it is advised that you close a workbook you are done with. So the final code will look like this:

 

using (ES.ExcelService excelService = new ES.ExcelService())

{

       excelService.Credentials = System.Net.CredentialCache.DefaultCredentials;

       ES.Status[] stati;

       string sessionId = excelService.OpenWorkbook(

              "https://MyServerName/Shared Documents/HelloWorld.xlsx",

              String.Empty, String.Empty, out stati);

       object o = excelService.GetCellA1(sessionId,

              "Sheet1",

              "A3",

              true,

              out stati);

       textBox1.Text = (string)o;

       excelService.CloseWorkbook(sessionId);

}

 

If you run your program now and click the Get Default button, you should get the “Hello Excel 2003” appear in the textbox.

Writing data back to Excel Services

We will now add code to the other button. Feel free to copy and paste the code we wrote for the first one into the Click event of the second one – we will just be adding code.

 

For this second example, we will write the value “Excel 2007” into the A2 cell – if everything works right, and you get the value from A3 (after setting the value in A2 of course), you should see the text “Hello Excel 2007” in the cell, instead of the default one in the saved workbook. For that, we will add a call to SetCellA1()  into the code we copied from the Get Default button, right before we call GetCellA1() :

excelService.SetCellA1(sessionId, "Sheet1",

       "A2", "Excel 2007");

 

That’s it! If you now run your sample and click the “Get Correct” button, you should see “Hello Excel 2007” in the textbox!

So what did we learn?

  • We now know how to add a web reference to Excel Services so that we can use it in our program.
  • We used the OpenWorkbook() method to open a workbook on the server.
  • Calling the SetCellA1() method allows us to manipulate the workbook that’s opened inside the session OpenWorkbook() gave us.
  • To get data from the workbook, we can call the GetCellA1() method.
  • When we are done with our session, we can call the CloseWorkbook() method.

 Note about the attached sample: You will need to change the name of the workbook constant at the top of the Form1 class to work with the name of your workbook. You will also need to change the ES web service properties to point to the server that hosts your Excel Services.

Blog_HelloWorld.zip

Comments

  • Anonymous
    March 27, 2006
    For those of you interested in programming Excel Services, check out this blog.
    One of the developers...

  • Anonymous
    March 29, 2006
    Thank you for this nice code preview.
    (Just a linguistic note: the plural of Latin word "status" is "status" (4th declension, not 2nd declension) ;-).

  • Anonymous
    March 30, 2006
    But it's not as funny. :)

  • Anonymous
    May 02, 2006
    Excel Services does not support External Workbook References. I show how you can use a UDF to get similar functionality.

  • Anonymous
    May 30, 2006
    Durante la preparaci&#243;n de las sesiones para el evento DevDays Andino 2006, cuyos temas principales fueron...

  • Anonymous
    June 06, 2006
    The comment has been removed

  • Anonymous
    June 06, 2006
    Prasad:

    Read the part in the article about "Creating the form and importing Excel Services API". You dont need to copy these assemblies - just use VS to create a proxy to the web-services.

  • Anonymous
    June 06, 2006
    Hi Shahar

    I have added the Web Refernece of the ExcelService web service in my console application.However I dont find any class by the name ExcelService in the instantiated proxy class.Instead I find the class ExcelServiceSoap.Although this contains a method called OpenWorkBook,the signature of the method is entirely different from what is given above eg and also in the msdn example which corresponds to the ExcelService class in the assembly Microsoft.Office.Excel.Server.WebServices.

  • Anonymous
    June 06, 2006
    Moreover I am using Office Server 2007 Beta 2.

  • Anonymous
    June 06, 2006
    Thanks!
    I realized my mistake.I had put the reference of the ExcelCalculation Server/ExcelService.asmx in my console application.

  • Anonymous
    August 20, 2006
    I need comment code

  • Anonymous
    August 21, 2006
    KieuAnh:

    Not sure what it is you want. Can you elaborate?

  • Anonymous
    September 07, 2006
    A related post - this one shows a Java application connecting with Excel Services via the web service interface.  -Dino

  • Anonymous
    September 13, 2006
    This post is a list of useful resources for developers working with the 2007 Microsoft Office&amp;nbsp;System...

  • Anonymous
    September 15, 2006
    Shahar,

    Can you comment if the CalculateA1 function is working.  I have a namedrange cell with a Rand() function in it.  When I open the workbook and try to CalculateA1 the cell with the rand() function it doesnt seem to update.  Any ideas?   I am not running the tech refresh.

  • Anonymous
    September 15, 2006
    Tyler,

    The reason you are not seeing anything change is that Excel Services optimizes the recalculation - it will not let a user recalc more than once per 5 minutes. This is configurable inside the Trusted Location - there's a setting called "Volatile function lifetime" or something similar that you can use to adjust the 5min. Setting it to zero will make it so that every recalc will realy recalc. Note that reducing this setting will impact performance as it will require Excel Services to recalculate more often.

    In B2TR, there's a slight change (as far as I remember) - a manual recalc will ignore the volatile cache time and actually do a recalc.

  • Anonymous
    September 28, 2006
    Instead of re-hashing information I've found elsewhere I figured a pre-reqs post would be good.
    One...

  • Anonymous
    October 30, 2006
    Instead of re-hashing information I've found elsewhere I figured a pre-reqs post would be good. One of

  • Anonymous
    November 14, 2006
    A very neatly explained example. Great work!!!

  • Anonymous
    November 15, 2006
    The comment has been removed

  • Anonymous
    November 15, 2006
    What error are you getting? Can you share the code you are running?

  • Anonymous
    November 15, 2006
    Hi Shahar, Iam not getting any error.i folowed the same steps which u have given. this is the code which iam writing data into the excel which is in Sharepoint server 2007 using excel webservices. Code:


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click        Try            Dim mystat() As MyExcelWebReference.Status            Dim targetpath As String          Using es As New MyExcelWebReference.ExcelService()             targetpath = "http://SharepointServer/ExcelServices/Amar/Shared%20Documents/Amar.xlsx"                es.PreAuthenticate = True                es.Credentials = System.Net.CredentialCache.DefaultCredentials                sessionid = es.OpenWorkbook(targetpath, String.Empty, String.Empty, status)                If (sessionid = "") Then                    MsgBox("Error in Opening Workbook")                Else                                                        es.SetCellA1(sessionid, "Sheet1", "A1", "Amar")                End If                es.CloseWorkbook(sessionid)             End Using        Catch ex As Exception            MsgBox(ex.Message)        End Try    End Sub

End Code Please look into this and give me the code sample. Thanks&Regards, Amar...

  • Anonymous
    November 15, 2006
    Oh. Are you expecting to see the value change inside the Excel workbook inside sharepoint?

  • Anonymous
    November 15, 2006
    Hi Shahar, Thanks for the fast response... yes i want to write some data into the excel located in the share point server 2007. can you give me the points. Thanks&Regards, Amar....

  • Anonymous
    November 15, 2006
    Ezcel Services is not an authoring environment. It was not meant in this version to "Save Back" to the SP server. It's still possible, but requires a few more steps.

  1. Call the GetWorkbook() method on the proxy to get back a byte array represnting your workbook.
  2. Use the SharePoint OM to save that byte array back to the server.
  • Anonymous
    November 15, 2006
    Thanks Shahar, please can you give me the sample code steps for this. once again thanks for the response. Regards, Amar...

  • Anonymous
    November 15, 2006
    I can, but it may actually take me a little while to do this. Don't have time for posting articles right now and while it's not complex, it's a fair amount of code. Until I get to do it, I suggest you search for information on how to use the SPFile.SaveBinary() method and take a look at the GetWorkbook() method of Excel Services. s

  • Anonymous
    November 15, 2006
    Thanks for the info.. I will check the details... Regards, Amar...

  • Anonymous
    November 16, 2006
    Hi All, I need some syntax to know the Active excelsheet name which i have opened using excel webservices. please give me the code samples for that. i want to see the active sheet neme when i open the excel in "view in browser" option in sharepoint server.

  • Anonymous
    November 16, 2006
    Can you elaborate on "i  want to see the active sheet neme when i open the excel in "view in browser" option in sharepoint server"? Not sure I undestand what you mean. s

  • Anonymous
    November 16, 2006
    Hi Shahar, I have published my excel sheet into the sharepoint server 2007. in that sheet in one cell i have placed one formula(i.e udf function) to get the activesheet name. now when i want to go and see the excel in "view in browser" option in Sharepoint server 2007t then i want to get the active sheet name in the given cell whare i have given the formaula. please help me out on this. Regards, Amar...

  • Anonymous
    November 16, 2006
    What is the UDF that returns the ActiveSheet name exactly? I wasn't aware that we supported something like that. (Which, of course, does not mean much, since there are many Excel functions I am not aware of. :)) s

  • Anonymous
    November 16, 2006
    Hi Shahar, I need one excel inbuilt funtion to get the Activesheet name. that only i want to write in the UDF to get the Active sheet name. Regards, Amar..

  • Anonymous
    November 16, 2006
    There is no such feature.

  • Anonymous
    November 16, 2006
    Can you explain what you need it for? It may help us in a future release.

  • Anonymous
    November 16, 2006
    Hi Shahar, Thanks... Regards, Amar...

  • Anonymous
    January 28, 2007
    The comment has been removed

  • Anonymous
    January 28, 2007
    How does a workflow work in Excel services?Basically i would like to know how the excel workbooks published on to the server behave when a workflow is  started.Will the documents be visible to particular user only after it is approved by the initiatir or some other approver? Thanks, Vandana

  • Anonymous
    January 29, 2007
    Anirudh: As for the first question: Excel Services is only enabled on the Enterprise version of MOSS. As far as I know, Project server is a different SKU that does not support it. For more help on that, you can try accessing the forums: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1208&SiteID=1 As for the second question: What is it that you are doing exactly when you say "I then tried to access the excelservice webservice of a RTM MOSS 2007 website"? Where do you get that COM error you describe?

  • Anonymous
    January 29, 2007
    Vandana: It all depends on what workflow you apply to the document library in question. There is no inherent process that happens for Workbooks on the server.

  • Anonymous
    January 29, 2007
    Hi, Thanks for the reply.I need bit more clarification on workflows. I have used approval workflow which routes the documenst thru all the workflow participants. whai i feel is once a document is approved then only it should go to next level for further processing. but i find no such restriction in excel services.Is there any  locking mechanism either thru custom workfkows or with predefined workflows wherein a workbook is viewed only if it approved by a particular user? Thanks, Vandana

  • Anonymous
    January 29, 2007
    Hi Shahar, First off thanks for the prompt reply! :) Well its a disappointment if exceservices is not supported for project server, because even the project web access websites created under Project Server offer that excelservice webservice,i.e. you can see it when you try to add the web reference. However it doesn't let you add this reference(button disabled) and the errors are printed in the web service despcrription txtbox. >> The document at the url http://litware:104/_vti_bin/ExcelService.asmx?wsdl was not recognized as a known document type. The error message from each known type may help you fix the problem:

  • Report from 'DISCO Document' is 'Root element is missing.'.
  • Report from 'WSDL Document' is 'There is an error in XML document (0, 0).'.
  • Root element is missing.
  • Report from 'XML Schema' is 'Root element is missing.'. << After that I tried to access a webservice of a MOSS RTM site (on the same machine) and got the COM error.I got a workaround for that(it was a site specific error) That was not the main issue; I really needed the excelserviceAPI for Project server. Are you sure it is not supported? :(
  • Anonymous
    January 30, 2007
    Anirudh, I am double-checking. But I think Excel Services comes only as part of the enterprise version. Vandana, I sent an email in the internal alias to see if something comes up. Both: Consider using the Excel Services forums (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1208&SiteID=1) for questions such as this - you will get more eyes on them.

  • Anonymous
    January 30, 2007
    Anirudh, Excel Services only comes as part of the MOSS for Internet Sites or the Enterprise packages. For more info, please follow this link: http://office.microsoft.com/en-us/help/HA101978031033.aspx

  • Anonymous
    January 31, 2007
    Hi All, I have created a approval workflow and i have added approvers name as administrator,spuser1 and i have assighned the work flow to the test document.after that i have loged in to the sharepoint server as another user.when i want to open the test document without approving the document logedin user able to open and edit the document but it should display some type of message like "it is not yet approved by the administrator workflow is in process". is there any locking is available for the document when workflow is processing. please anybody can give the flow of the work flow and approval steps and workflow conifiguration. regards, Amar...

  • Anonymous
    March 20, 2007
    Hi All, I want to know how to auto schdule my excel files in sharepoint server 2007.is there any provision given by sharepoint server 2007 to schdule the files and also programatically how can set the schduler.In sharepoint there is one dll i.e Microsoft.SharePoint.SPSchedule how can we work on this iam not clear.can anybody can send sample code and help on this. Thanks&Regards, Amar..

  • Anonymous
    March 20, 2007
    Can you explain what "Auto Scheduling" means? What's the expected behavior? What do you want them to auto schecule to?

  • Anonymous
    May 10, 2007
    Hi Sahar, While opening the workbook I am getting "The file that you selected could not be found. Check the spelling of the file name and verify that the location is correct" error, but the path of the excel that I am giving is correct. How can I resolve this. Can we refresh the document that is stored in Sharepoint under Excel trusted Location by calling Refresh method that is available with Excel services workbook? Is this possible?

  • Anonymous
    May 11, 2007
    I am getting the Error while opening the workbook, error is "You do not have permissions to open this file on Excel Services." The excel file that I am opening is in trusted location in sharepoint. Do we need to give any permissions to that document in sharepoint document library. How do I can resolve this? Here is the full code       ExcelService currentService = new ExcelService();        string targetPath = "http://localhost/Documents/TestDoc.xlsx";                    Status[] outStatus;        currentService.Credentials = System.Net.CredentialCache.DefaultCredentials;        string sessionId = currentService.OpenWorkbook(targetPath, "en-US", "en-US", out outStatus); Thanks in Advance, Sasya

  • Anonymous
    May 13, 2007
    Can you choose "View in WebBrowser" in the drop down on the file?

  • Anonymous
    May 13, 2007
    View in WebBrowser" in the drop down on the file is working from Sharepoint document library. But I am getting the error while accessing using Excel web services. How do I resolve this error? Thanks, Sasya

  • Anonymous
    May 13, 2007
    The excel sheet that I am trying to access from Excel Service also has Data Connections, which are used to pull data from database(SQL server). Thanks Sasya

  • Anonymous
    May 13, 2007
    Hi, I am using Excel services for refreshing the excel sheet and then trying to save refreshed document to the Sharepoint library.Below is the thing that I am trying out:

  1. Opening the workbook from Sharepoint trusted location.
  2. Refreshing the excel report(Has Pivot Tables and Pivot Charts).
  3. Writing refreshed data to an external file. Here is the code:        ExcelService currentService = new ExcelService();        string targetPath = "http://localhost/Documents/EmpDept.xlsx";        Status[] outStatus;        currentService.Credentials = System.Net.CredentialCache.DefaultCredentials;         string sessionId = currentService.OpenWorkbook(targetPath, "en-US", "en-US", out outStatus);        currentService.Refresh(sessionId, "Employees");        byte[] contents = currentService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, out outStatus); using (BinaryWriter binWriter =        new BinaryWriter(File.Open(@"C:Test.xlsx", FileMode.Create)))        {            binWriter.Write(contents);        }        currentService.CloseWorkbook(sessionId); I have modified my data source by adding new records, But even after the refresh also the excel report is not getting refreshed. When I check Text.xls it is as same as the Source excel and not updated with the latest data from data source. When I refreh the Connection from Excel the sheet is getting refreshed with the latest data from my datasource. Is there anything I am missing here? Any help will be appreciated. Regards, Sasya
  • Anonymous
    May 13, 2007
    Sasya: RE: Failure of EWA What's the error you are saying? RE: Api question. Hmm. That's very strange.
  1. What does the connection shunt information to? (PivotTable?)
  2. What happens if you call .RefreshAll() instead of .Refresh()? s
  • Anonymous
    May 13, 2007
    The comment has been removed

  • Anonymous
    May 14, 2007
    I have a problem opening a workbook from a remote machine using Excel web services. I am getting the following error: URL authorization failed for the request I am using the default credentials for Excel web services in code. from X machine I am calling openworkbok for the url on machine MySite URL passed in as parameter for OpenWorkBook is :http://MySite/Reports/Salaries.xlsx Thanks in advance SL

  • Anonymous
    May 14, 2007
    SL: Can you navigate to http://MySite/_vti_bin/ExcelServices.asmx ?

  • Anonymous
    May 14, 2007
    If I try to access the url http://MySite/_vti_bin/ExcelServices.asmx I am getting the error from machine x as well as machine Mysite, and Just it is displaying that an Error has occurred. In eventViewer I didnt see any message related to that. But on Mysite I can view http://MySite/Reports/Salaries.xlsx without any error in WebBrowser by clicking View in WebBrowser link in the dropdown in Document library. But If I am accessing ExcelServices.asmx on MySite machine with http://localhost/_vti_bin/ExcelServices.asmx, I am able to access it without any error. And in IIS for Office Server Web Services is configured with both Annonymous and Windows authentication. MySite/_vti_bin/ExcelServices.asmx is also configured with both Annonymous and Windows authentication. Thanks, SL

  • Anonymous
    May 14, 2007
    Sahara,         I have strucked with the Data refresh problem using Excel services using C# code. It is not working as documented in MSDN if my document has data connections to external data sources. Thanks in Advance, Sasya

  • Anonymous
    May 14, 2007
    Sasya, If you choose the "Refresh All Connections" from the  EWA toolbar does it work? (So, load the file in EWA and select the "Refresh ALL" and see if you get the new information you expect).

  • Anonymous
    May 14, 2007
    SL, Excel Services API isn't accessible to anonymuos users, so you either must authenticate by supplying a network credentials (e.g. CredentialsCache.DefaultCredentials), or if you'd like you can modify the permissions of the anonymous user so that it has the "UseRemoteApi" permission. You can alter the permissions of the anonymous user from OM, or you can grant anonymous users full access to websites. I hope this helps.

  • Anonymous
    May 14, 2007
    Hi Levin, Here is the code that I am using: ExcelService currentService = new ExcelService();        string targetPath = "http://MySite/Reports/Salaries.xlsx";        Status[] outStatus;        currentService.Credentials = System.Net.CredentialCache.DefaultCredentials;        string sessionId = currentService.OpenWorkbook(targetPath, "en-US", "en-US", out outStatus);        currentService.Refresh(sessionId, "");        byte[] contents = currentService.GetWorkbook(sessionId, WorkbookType.FullWorkbook, out outStatus); In my code I am using CredentialsCache.DefaultCredentials, but still OpenWorkBook is throwing out an error. And annonymous access in IIS is configured with Service account. And I have tried running this code from the machine MySite, I am still getting the error. Regards, SL

  • Anonymous
    May 23, 2007
    Hi Anirudh, if you have created a site collection then use the url reference as: http://<server>/sites/<sitename>/_vti_bin/excelservice.asmx Regards Majeti

  • Anonymous
    July 05, 2007
    Hi All, I have deployed a web application which uses excel web service on a sharepoint site. I have some named items on the excel sheet. How can i programatically get the list of all the named items/parameters defined in there. Regards, Sush

  • Anonymous
    July 09, 2007
    You cannot. The only workarounds you have available (afaik) are:

  1. Know the names before hand.
  2. Place the names in a hidden sheet and have a well known range name for the range that contains all the named ranges. Then use that to get the names.
  • Anonymous
    July 26, 2007
    Hi there, My project/app is called Webexcel1. I added a webreference called ES. But it doesn't recognize the namespace ES. I tried it with the first using and the second one. ... //using Webexcel1.ES; using System.Web.Services.Protocols; using (ES.ExcelService excelService = new ES.ExcelService()) {       excelService.Credentials = System.Net.CredentialCache.DefaultCredentials; } ... Thanks! Frank

  • Anonymous
    July 27, 2007
    Already solved my problem. It was due to a lack of knowledge in VS. I had the using declarations in the wrong spot of my project. Basics.... Works fine now. Thanks and good luck.

  • Anonymous
    September 27, 2007
    The comment has been removed

  • Anonymous
    September 27, 2007
    hi! my servlet return excel file i am getting excel file for java script request,but let me know how do open or display excel file through ajax responseText regards Thana

  • Anonymous
    October 01, 2007
    That's not something you can do today. The only thing you can do is use AJAX to get data from Excel Services.

  • Anonymous
    November 22, 2007
    is it necessary to install office 2007 and devloper's machine or they can access from share point server. if Office 2003 is present on the local system what are the minimum requirements for developer machine if share point server machine has share point 2007 and excel 2007

  • Anonymous
    November 28, 2007
    You dont need anything installed on the Developer machine - just a connection to the Excel Services SharePoint.

  • Anonymous
    February 22, 2008
    The comment has been removed

  • Anonymous
    February 22, 2008
    Can you open the file via EWA? When you run into issues like that, that's the first thing you should check - that will tell you whether the issue is with the server or with your software.

  • Anonymous
    February 22, 2008
    I can open it via EWA. Sorry bout leaving that part out before. I'm thinking it might have something to do with either the default credentials I'm passing into the function. Or that it has to do with the workbook location. The workbook is located in a content database path (http://servername/site/subsite/filename.xlsx).

  • Anonymous
    February 24, 2008
    Can i set security on Sheet level in a published workbook in Excel Services? My intension to publish a workbook with four sheets( i.e. user1,user2,user3,Admin). Every user have only access to his/her sheet only. But Admin can view all sheets as well as by using excel built-in formulas he can go for some calculations by taking input from some/all other user sheets information. Does it possible in Excel Services?

  • Anonymous
    February 26, 2008
    Jason: If your user can open it in a browser, they should be able to open it through the API. What type of application is this? Phaneendra: We do not support this level of granularity with security - sorry.

  • Anonymous
    February 27, 2008
    I am facing a similar kind of issue regarding SOAP exception at OpenWorkBook method. i am able to open the sheet in browser, i.e. it is working fine in EWA, but  not coming up using web service. I have checked that the workbook is stored at the trusted location. also I have checked the permission of the user. It's not working even by providing the Full Control. What else could be the possible reason for this SOAP Exception?

  • Anonymous
    February 28, 2008
    Can you paste the skeleton of your code (everything relevant up to and including the OpenWorkbook call)?

  • Anonymous
    February 28, 2008
    Here is that snippet of code: private void button1_Click(object sender, EventArgs e)        {            ExcelService proxyService = new ExcelService();            proxyService.SoapVersion = SoapProtocolVersion.Soap12;            proxyService.Credentials = System.Net.CredentialCache.DefaultCredentials;            Status[] status = null;            string SessionId = null;            string pathWorkbook = "http://litwaredemo:13300/sites/mysitecollection/ExcelWorkBooks/Calculator.xlsx";            SessionId = proxyService.OpenWorkbook(pathWorkbook, String.Empty, String.Empty, out status);            status = proxyService.SetCellA1(SessionId, "Calculator", "Loan", textBox1.Text);            status = proxyService.SetCellA1(SessionId, "Calculator", "Rate", textBox2.Text);            status = proxyService.SetCellA1(SessionId, "Calculator", "Years", textBox3.Text);            status = proxyService.CalculateWorkbook(SessionId, CalculateType.CalculateFull);            object result = null;            result = proxyService.GetCellA1(SessionId, "Calculator", "Payment", true, out status);            if (result != null)                textBox4.Text = result.ToString();            proxyService.CloseWorkbook(SessionId);        } Its just a small application for calculation. SessionId = proxyService.OpenWorkbook(pathWorkbook, String.Empty, String.Empty, out status); this line of code is throwing the SOAP exception.

  • Anonymous
    March 12, 2008
    hey guys i have s problem........ While using UDF's i get the return values in a data table. Now i wannt to show this entire table in the excle sheet as it is. How can I do that?

  • Anonymous
    March 13, 2008
    Can you further explain what the issue is? what do you mean by Data table? What tdo you mean "as it is"?

  • Anonymous
    March 26, 2008
    Hi, The OpenWorkbook() is throwing the following exception: "Excel Web Services could not determine the Windows SharePoint Services site context of the calling process" Please note: 1> I'm using Excel Web Reference not static binding 2> The excel file is in trusted location. 3> I'm able to browse the excel file using IE. Please let me know what colud be the problem?

  • Anonymous
    August 17, 2009
    Hi Sahar, This is kiran reddy. i Want to know how to convert  excel data in Visual Basic code language

  • Anonymous
    August 17, 2009
    Not sure I understand the question, Kiran.

  • Anonymous
    August 18, 2009
    how to learn visual basic through online? is there anybody to teach VB

  • Anonymous
    September 05, 2013
    how to learn visual basic through online? is there anybody to teach VB