How to Query Database from Task Pane App and insert the query data into excel RRS feed

  • Question

  • I hava a database for my contacts,I want to query the database with telephone or Identity card number to get more information about the people, and then insert the query data into excel.

    Can anyone provide a simple sample code for doing this use JavaScript API for Office.

    Friday, March 8, 2013 6:51 AM


  • Hi

    You can use jquery ajax call to query your webserivce.

    Assuming your webservice is running on


    which accepts parameter string identification.

    You can preform a query like

    $.ajax('http://my.service.com/GetList', {
        dataType: 'jsonp', // to support cross domain
        data: {
            identification: 'telephone number'
        cache: false,
        success: function (data, textStatus, jqXHR) {
    function processReturnValue(data) {

    Note that your web service needs to return a json object. On how to format the webservice respons look here. To simply exaplint it: jsonp adds another url parameter named _callback. And you need to use this callback parameter in response.

    Read more about jquery and its ajax method.

    Anze Javornik

    Friday, March 8, 2013 11:50 AM