openpyxl.writer.excel module¶
Write a .xlsx file.
-
class
openpyxl.writer.excel.
ExcelWriter
(workbook, archive)[源代码]¶ 基类:
object
Write a workbook object to an Excel file.
-
openpyxl.writer.excel.
save_virtual_workbook
(workbook)[源代码]¶ Return an in-memory workbook, suitable for a Django response.
注解
Deprecated: Use a NamedTemporaryFile
-
openpyxl.writer.excel.
save_workbook
(workbook, filename)[源代码]¶ Save the given workbook on the filesystem under the name filename.
参数: - workbook (
openpyxl.workbook.Workbook
) – the workbook to save - filename (string) – the path to which save the workbook
返回类型: bool
- workbook (
-
openpyxl.writer.excel.
tostring
(element, *, encoding='utf-8', method=None, short_empty_elements=True)¶ Generate string representation of XML element.
All subelements are included. If encoding is “unicode”, a string is returned. Otherwise a bytestring is returned.
element is an Element instance, encoding is an optional output encoding defaulting to US-ASCII, method is an optional output which can be one of “xml” (default), “html”, “text” or “c14n”.
Returns an (optionally) encoded string containing the XML data.