In this post, you’ll learn about the error message “DimensionAndArrayMismatch – The size of the provided array does not match the size and shape of the destination range.” that you usually receive when working eith the Excel Services in SharePoint.
When working with SharePoint Excel Services, there are error codes that are generated in the SOAP exception when the errors occur in the Excel Services. You can use the SubCode property that is available in the SoapException class to identity these error codes and troubleshoot the issue.
Error Message
DimensionAndArrayMismatch – The size of the provided array does not match the size and shape of the destination range.
Reason for the Error
The caller tried to set a range into a workbook but the parameter that contains the array values does not match the target range.
Solution
Make sure the size of the provided array matches the dimensions of the destination range (for example, 2 columns wide by 3 rows high).