On the basis of this article , I created a ms sql database, including the models and controllers in a Excel Web AddIn (TaskPane)
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 javascript (not working)
function loadSampleData() { var db = new Controllers.controllerMovie(); var values = db.ActionResult; // 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); }