3.1.4.43 SetRange

This operation is used to set values to a range of worksheet cells on a workbook.

 <wsdl:operation name="SetRange">
   <wsdl:input wsam:Action="http://schemas.microsoft.com/office/Excel/Server/WebServices/ExcelServerInternalService/ExcelServiceSoap/SetRange" message="tns:ExcelServiceSoap_SetRange_InputMessage"/>
   <wsdl:output wsam:Action="http://schemas.microsoft.com/office/Excel/Server/WebServices/ExcelServerInternalService/ExcelServiceSoap/SetRangeResponse" message="tns:ExcelServiceSoap_SetRange_OutputMessage"/>
   <wsdl:fault wsam:Action="http://schemas.microsoft.com/office/Excel/Server/WebServices/ExcelServerInternalService/ExcelServiceSoap/SetRangeExcelServerMessageFault" name="ExcelServerMessageFault" message="tns:ExcelServiceSoap_SetRange_ExcelServerMessageFault_FaultMessage"/>
 </wsdl:operation>

The protocol client sends an ExcelServiceSoap_SetRange_InputMessage request message and the protocol server responds with an ExcelServiceSoap_SetRange_OutputMessage response message as follows:

  1. If cellsArray is not present, the protocol server MUST return an ExcelServerMessage as specified in the SOAP fault section. The Id element of the ExcelServerMessage MUST be "RangeDefinitionError".

  2. If the SheetName element inside sheetRange is empty, the protocol server MUST return an ExcelServerMessage as specified in the SOAP fault section. The Id element of the ExcelServerMessage MUST be "InvalidSheetName".

  3. If the user does not have the Open Item permission on the workbook, cellsArray SHOULD<55> contain only one item.

  4. Each element inside the cellsArray element MUST be of type ArrayOfAnyType and be a row of worksheet cells sent to the protocol server. The number of rows in cellsArray MUST be equal to the number of rows specified in the sheetRange element.

  5. Each element inside each of the ArrayOfAnyType type nested inside cellsArray MUST be a single worksheet cell. The number of elements inside each such nested ArrayOfAnyType MUST be equal to the number of columns (2) specified in the sheetRange element.

  6. If the values element in the cellsArray contains formulas not recognized by the protocol server, then:

    • If the value of ProtocolClientId element in the parameter as defined in section 2.2.4.20 is set to "ms-ewa", the protocol server sets the text representation of the formulas into the cells.

    • If the value of ProtocolClientId element in the parameter as defined in section 2.2.4.20 is set to "ms-soap", the protocol server returns a SOAP fault as specified in section 2.2.2. The Id element of the ExcelServerMessage MUST be "FormulaParseFailed".

  • All worksheet cells in the cellsArray element MUST either be empty and with the xsi:nil attribute set to "true" or one of the following types: boolean, dateTime, decimal, double, float, int, short, string, or unsigned byte.

    • If the value is of type string, it MUST NOT be longer than 32767 characters.

    • If the protocol server does not support the value, it MUST return a SOAP fault.

    • If the protocol server does not support setting a value in the specified location, it MUST return a SOAP fault.

This operation is a state changing operation on the protocol server.

In the event of an application error on the protocol server during this operation, a SOAP fault is returned, as specified in section 2.2.2. The Id element of the ExcelServerMessage SHOULD<56> be one of the values specified in section 2.2.2.1 or any of the following values:

  • "CannotEditPivotTable"

  • "DimensionMismatch"

  • "EcsInvalidNamedObject"

  • "FormulaEditingNotEnabled"

  • "InvalidSheetName"

  • "ObjectTypeNotSupported"

  • "RangeDefinitionError"

  • "RangeParseError"

  • "SetRangeFailure"

  • "SheetRangeMismatch"