获取或者创建sheet表<br>
如果sheet表在Workbook中已经存在，则获取之，否则创建之

@param book 工作簿{@link Workbook}
@param sheetName 工作表名
@return 工作表{@link Sheet}
@since 4.0.2
323223
public static Sheet getOrCreateSheet(Workbook book, String sheetName) {
		if (null == book) {
			return null;
		}
		sheetName = StrUtil.isBlank(sheetName) ? "sheet1" : sheetName;
		Sheet sheet = book.getSheet(sheetName);
		if (null == sheet) {
			sheet = book.createSheet(sheetName);
		}
		return sheet;
	}
433903
def openSheet(self, name):
        '''  '''
        if name not in self.__sheetNameDict:
            sheet = self.__workbook.add_sheet(name)
            self.__sheetNameDict[name] = sheet

        self.__sheet = self.__sheetNameDict[name]
216368
public static List<Map<String, Object>> handleSheetToMapList(Sheet sheet) throws ReadExcelException {
        List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
        // 得到Sheet里的列名
        List<String> columnList = ReadExcelUtils.getColumnOfSheet(sheet);
        for (int i = 2; i < sheet.getLastRowNum() + 1; i++) {
            Map<String, Object> beanMap = new HashMap<String, Object>();
            // 得到行
            Row row = sheet.getRow(i);
            // 遍历列
            for (int j = 0; j < row.getLastCellNum(); j++) {
                // 获取单元格
                Cell cell = row.getCell(j);
                if (cell != null) {
                    // 单元格对应列名
                    String key = columnList.get(j);
                    // 单元格对应值
                    Object value = ReadExcelUtils.getCellValue(cell.getCellType(), cell);
                    // key-value pairs 放入map
                    if (value != null) {
                        beanMap.put(key, value);
                    }
                }
            }
            // 将每个beanMap放入List中
            if (!beanMap.isEmpty()) {
                listMap.add(beanMap);
            }
        }
        return listMap;
    }
369481
def sheetDeleteEmpty(bookName=None):
    """"""
    if bookName is None:
        bookName = activeBook()
    if not bookName.lower() in [x.lower() for x in bookNames()]:
        print("can't clean up a book that doesn't exist:",bookName)
        return
    poBook=PyOrigin.WorksheetPages(bookName)
    namesToKill=[]
    for i,poSheet in enumerate([poSheet for poSheet in poBook.Layers()]):
        poFirstCol=poSheet.Columns(0)
        if poFirstCol.GetLongName()=="" and poFirstCol.GetData()==[]:
            namesToKill.append(poSheet.GetName())
    for sheetName in namesToKill:
        print("deleting empty sheet",sheetName)
        sheetDelete(bookName,sheetName)
557040
@Override
    public XlsxWorksheet getSheet(int i)
    {
        XlsxWorksheet ret = null;
        if(sheets != null)
        {
            Sheet sheet = (Sheet)sheets.get(i);
            if(sheet != null)
                ret = getSheet(sheet.getName());
        }
        return ret;
    }
1238431
def read_excel_file(inputfile, sheet_name):
    
    workbook = xlrd.open_workbook(inputfile)
    output = []
    found = False
    for sheet in workbook.sheets():
        if sheet.name == sheet_name:
            found = True
            for row in range(sheet.nrows):
                values = []
                for col in range(sheet.ncols):
                    values.append(sheet.cell(row, col).value)
                output.append(values)
    if not found:  # pragma: no cover
        raise MQ2Exception('Invalid session identifier provided')
    return output
132469
def __getSheet(self, name):
        '''  '''
        if not self.sheetExsit(name):
            raise UfException(Errors.SHEET_NAME_INVALID, "Can't find a sheet named %s" % name)

        return self.__sheetNameDict[name]
807618
public static function byName(Spreadsheet $spreadsheet, string $name): Sheet
    {
        if (!$spreadsheet->sheetNameExists($name)) {
            throw SheetNotFoundException::byName($name);
        }

        return new static($spreadsheet->getSheetByName($name));
    }
621420
public List<Sheet> getSheets() {
		final int totalSheet = getSheetCount();
		final List<Sheet> result = new ArrayList<>(totalSheet);
		for (int i = 0; i < totalSheet; i++) {
			result.add(this.workbook.getSheetAt(i));
		}
		return result;
	}
396740
def add_worksheet(name = nil)
      if name.nil? then
        n = 0

        begin
          name = SHEET_NAME_TEMPLATE % (n += 1)
        end until self[name].nil?
      end

      new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)
      worksheets << new_worksheet
      new_worksheet
    end
1185627
public Workbook writeToExcel(List<? extends Object> datas, boolean hasTitle,
                                 Workbook workbook) {
        return writeToExcel(datas, hasTitle, workbook, false);
    }
625892
public List<String> getAllSheetNames() {
    checkState(!isClosed, WORKBOOK_CLOSED);
    List<String> sheets = newArrayList();
    for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
      sheets.add(workbook.getSheetName(i));
    }
    return sheets;
  }
86508
@SuppressWarnings("unchecked")
	public T setSheet(int sheetIndex) {
		try {
			this.sheet = this.workbook.getSheetAt(sheetIndex);
		} catch (IllegalArgumentException e) {
			this.sheet = this.workbook.createSheet();
		}
		if (null == this.sheet) {
			this.sheet = this.workbook.createSheet();
		}
		return (T) this;
	}
1256718
public static List<?> workbook2List(ExcelConfig config, Workbook wb) throws Exception {
        String[] names = config.getNames();
        String[] types = config.getTypes();
        Field key = config.getKey();

        List<Object> list = new ArrayList<Object>();
        Sheet sheet = wb.getSheet(config.getSheetNum());
        int length = sheet.getColumns() < names.length ? sheet.getColumns() : names.length;
        //计算行数
        int rowLength = sheet.getRows() < config.getMaxRow() ?
                sheet.getRows() : (config.getMaxRow() > 0 ? (config.getMaxRow() + config.getStartRow()) : sheet.getRows());

        for (int i = config.getStartRow(); i < rowLength; i++) {
            //Map类型要特殊处理
            Class clazz = Class.forName(config.getClazz());
            Object obj = null;
            if (Map.class.isAssignableFrom(clazz)) {
                obj = new HashMap();
            } else {
                obj = clazz.newInstance();
            }
            for (int j = 0; j < length; j++) {
                setValue(obj, names[j], types[j], sheet.getCell(j, i));
            }
            //checkKey
            if (key != null) {
                //当主键为空时，不在继续读取excel
                if (key.get(obj) == null || "".equals(String.valueOf(key.get(obj)))) {
                    break;
                }
            }
            list.add(obj);
        }
        return list;
    }
974441
def sheetDelete(book=None,sheet=None):
    
    if book is None:
        book=activeBook()
    if sheet in sheetNames():
        PyOrigin.WorksheetPages(book).Layers(sheetNames().index(sheet)).Destroy()
1200710
File appendSheet(final List<WorksheetContent> worksheetContents) throws IOException {
        final ImmutableSet<String> worksheetNames = FluentIterable.from(worksheetContents)
                .transform(new Function<WorksheetContent, String>() {
                    @Nullable @Override public String apply(@Nullable final WorksheetContent worksheetContent) {
                        return worksheetContent.getSpec().getSheetName();
                    }
                }).toSet();
        if(worksheetNames.size() < worksheetContents.size()) {
            throw new IllegalArgumentException("Sheet names must have distinct names");
        }
        for (final String worksheetName : worksheetNames) {
            if(worksheetName.length() > 30) {
                throw new IllegalArgumentException(
                        String.format("Sheet name cannot exceed 30 characters (invalid name: '%s')",
                                worksheetName));
            }
        }

        final XSSFWorkbook workbook = new XSSFWorkbook();
        final File tempFile =
                File.createTempFile(ExcelConverter.class.getName(), UUID.randomUUID().toString() + XLSX_SUFFIX);
        final FileOutputStream fos = new FileOutputStream(tempFile);

        for (WorksheetContent worksheetContent : worksheetContents) {
            final WorksheetSpec spec = worksheetContent.getSpec();
            appendSheet(workbook, worksheetContent.getDomainObjects(), spec.getFactory(), spec.getSheetName());
        }
        workbook.write(fos);
        fos.close();
        return tempFile;
    }
406476
public List<String> getHeaderRowContents(String sheetName, int size) {
        return excelReader.getHeaderRowContents(sheetName, size);
    }