0

I've created a Excel task pane app with VS2015 (Excel Web Addin) and Office tools.

On the basis of this article, I've also created an ms sql database, including the models and controllers.

How can I populate the contents of the table Movie in Excel?

This is the controller:



       namespace DatabaseWeb.Controllers
    {
        public class controllerMovie : Controller
        {
            private modelMovie db = new modelMovie();

            // GET: controllerMovie
            public ActionResult Index()
            {
                return View(db.Movies.ToList());
            }
    

This is the home.js (not working)


    function loadSampleData() {

            var values = getMovies();

            // Run a batch operation against the Excel object model
            Excel.run(function (ctx) {


                // Create a proxy object for the active sheet
                var sheet = ctx.workbook.worksheets.getActiveWorksheet();
                // Queue a command to write the sample data to the worksheet
                sheet.getRange("B3:D5").values = values;

                // Run the queued-up commands, and return a promise to indicate task completion
                return ctx.sync();
            })
            .catch(errorHandler);
        }


        function getMovies() {

            $.ajax({
                type: "GET",
                url: "Controllers/controllerMovie",
                success: function (result) {
                    return result;
                },
                error: function (response) {
                    return "fout";
                }
            });

        }

Can I request the table Movies data via ajax and what is the exact syntax?

  • Is this in excel because if do just use the in built connection functions. 10 easier – Dheebs Aug 16 '16 at 13:48
  • How can i do this? –  Aug 17 '16 at 17:26
  • Under data tab there is a section for connections. Https://support.office.com/en-us/article/Connect-to-import-SQL-Server-data-0f3d2e8f-7d94-4ded-baa6-3b0df183ff98 – Dheebs Aug 17 '16 at 17:39
  • i'm creating a Excel task pane app in visual studio with office tools –  Aug 17 '16 at 18:42

0 Answers0