def convert_range3d(token, _class)
    # Split the ref at the ! symbol
    ext_ref, range = token.split('!')

    # Convert the external reference part
    ext_ref = pack_ext_ref(ext_ref)

    # Split the range into 2 cell refs
    cell1, cell2 = range.split(':')

    # A range such as A:D is equivalent to A1:D65536, so add rows as required
    cell1 += '1'     unless cell1 =~ /\d/
    cell2 += '65536' unless cell2 =~ /\d/

    # Convert the cell references
    row1, col1 = cell_to_packed_rowcol(cell1)
    row2, col2 = cell_to_packed_rowcol(cell2)

    # The ptg value depends on the class of the ptg.
    if    (_class == 0)
      ptgarea = [@ptg['ptgArea3d']].pack("C")
    elsif (_class == 1)
      ptgarea = [@ptg['ptgArea3dV']].pack("C")
    elsif (_class == 2)
      ptgarea = [@ptg['ptgArea3dA']].pack("C")
    else
      exit "Unknown function class in formula\n"
    end

    ptgarea + ext_ref + row1 + row2 + col1+ col2
  end
def convert_range3d(token, _class)
    # Split the ref at the ! symbol
    ext_ref, range = token.split('!')

    # Convert the external reference part
    ext_ref = pack_ext_ref(ext_ref)

    # Split the range into 2 cell refs
    cell1, cell2 = range.split(':')

    # A range such as A:D is equivalent to A1:D65536, so add rows as required
    cell1 += '1'     unless cell1 =~ /\d/
    cell2 += '65536' unless cell2 =~ /\d/

    # Convert the cell references
    row1, col1 = cell_to_packed_rowcol(cell1)
    row2, col2 = cell_to_packed_rowcol(cell2)

    # The ptg value depends on the class of the ptg.
    if    (_class == 0)
      ptgarea = [@ptg['ptgArea3d']].pack("C")
    elsif (_class == 1)
      ptgarea = [@ptg['ptgArea3dV']].pack("C")
    elsif (_class == 2)
      ptgarea = [@ptg['ptgArea3dA']].pack("C")
    else
      exit "Unknown function class in formula\n"
    end

    ptgarea + ext_ref + row1 + row2 + col1+ col2
  end
Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to
 a ptgArea3dV.