I am using this the following code to bind to a column in excel using Excel office addin.
var myBindings = Office.context.document.bindings;
var myAddress = "Sheet1!A1:B10";
myBindings.addFromNamedItemAsync(myAddress, "matrix", {id:"myBind"},
function(result){});
This works fine, but if the sheet name contains a hypen(-) the same code fails with the message "The named item does not exist."
for instance following code fails.
var myBindings = Office.context.document.bindings;
var myAddress = "Sheet1-1!A1:B10";
myBindings.addFromNamedItemAsync(myAddress, "matrix", {id:"myBind"},
function(result){});
Please let me if this is bug in the platform or I am doing something wrong here.
Updating the answer as it works,
var myAddress = "'Sheet1-1'!A1:B10";
When the sheet name contains a space or special characters, the ''
has to be used