๐ŸŒ
XlsxWriter
xlsxwriter.readthedocs.io โ€บ tutorial01.html
Tutorial 1: Create a simple XLSX file โ€” XlsxWriter
import xlsxwriter # Create a workbook and add a worksheet. workbook = xlsxwriter.Workbook('Expenses01.xlsx') worksheet = workbook.add_worksheet() # Some data we want to write to the worksheet. expenses = ( ['Rent', 1000], ['Gas', 100], ['Food', 300], ['Gym', 50], ) # Start from the first cell.
๐ŸŒ
XlsxWriter
xlsxwriter.readthedocs.io
Creating Excel files with Python and XlsxWriter โ€” XlsxWriter
XlsxWriter is a Python module for creating Excel XLSX files. ... XlsxWriter is a Python module that can be used to write text, numbers, formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.
Discussions

Create new xlsx file | Chandoo.org Excel Forums - Become Awesome in Excel
Hi, please, can someone make me a macro that would do this. I would like to generate a new xlsx file by double-clicking on define cell in a row, which would place certain cells from this row in a new file. For example, after double-clicking on cell E7 *or select and run macro), I would like to... More on chandoo.org
๐ŸŒ chandoo.org
October 9, 2024
How can I create an xlsx fie and save it for export as a csv file?
Open Microsoft Excel and enter your data into the spreadsheet. Once your data is ready, go to File > Save As. Choose a location to save your file and select Excel Workbook (*.xlsx) from the Save as type dropdown menu. More on learn.microsoft.com
๐ŸŒ learn.microsoft.com
2
0
Generate XLSX files - dev - Lucee Dev
Hello, I have a website where HTML tables are created dynamically. Some cells are also linked. Now I would like to offer an export function with which the tables can be saved as xlsx files. I have now read that Lucee does not offer spreadsheet manipulation. So something like SpreadsheetMergeCells ... More on dev.lucee.org
๐ŸŒ dev.lucee.org
0
May 30, 2024
.net - How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office? - Stack Overflow
The original text of the question ... using Excel directly to create the file (using OLE Automation.)" It's unfortunate the question was drastically simplified. ... Assuming you were trying to do something sans library or external code, I can't speak for xls file, but for xlsx files, why ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Oreate AI
oreateai.com โ€บ blog โ€บ creating-an-xlsx-file-a-simple-guide โ€บ c0e079854b55ac87f5cff8aea1ab42d4
Creating an XLSX File: A Simple Guide - Oreate AI Blog
January 15, 2026 - Once you have Excel ready to go, follow these simple steps: Open Microsoft Excel: Launch the application from your desktop or start menu. Create a New Workbook: Click on 'File' then select 'New'.
๐ŸŒ
Chandoo.org
chandoo.org โ€บ home โ€บ forums โ€บ forums โ€บ vba macros
Create new xlsx file | Chandoo.org Excel Forums - Become Awesome in Excel
October 9, 2024 - Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) 'https://chandoo.org/forum/threads/create-new-xlsx-file.57812/ Dim arr As Variant Dim TargArr As Range Dim newWbk As Workbook Dim myPath As String Cancel = True Application.ScreenUpdating = False arr = Array(Me.Cells(Target.Row, 5).Value, Me.Cells(Target.Row, 6).Value, Me.Cells(Target.Row, 11).Value, _ Me.Cells(Target.Row, 12).Value, Me.Cells(Target.Row, 54).Value, Me.Cells(Target.Row, 55).Value, Me.Cells(Target.Row, 59).Value) Set newWbk = Workbooks.Add Set TargArr = newWbk.Sheets(1).Range("A1:A7") TargArr.Value
๐ŸŒ
Adobe
adobe.com โ€บ uk โ€บ acrobat โ€บ resources โ€บ document-files โ€บ spreadsheet-files โ€บ xlsx.html
How to Open, Read and Edit an Excel file format | Adobe
Introduced in 2007, XLSX files have become one of the most common types of file formats. Read on to discover what XLSX files are, what they are used for and how to open and edit them. ... Over 9 million files are uploaded every month. ... What youโ€™ll learn. ... An .XLSX file is a Microsoft Excel Open XML Format Spreadsheet file. It uses the file name extension .XLSX. Unlike other spreadsheets, you need Microsoft Excel to create .XLSX files.
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ answers โ€บ questions โ€บ 5701851 โ€บ how-can-i-create-an-xlsx-fie-and-save-it-for-expor
How can I create an xlsx fie and save it for export as a csv file? - Microsoft Q&A
Open Microsoft Excel and enter your data into the spreadsheet. Once your data is ready, go to File > Save As. Choose a location to save your file and select Excel Workbook (*.xlsx) from the Save as type dropdown menu.
๐ŸŒ
XYplorer
xyplorer.com โ€บ xyfc โ€บ viewtopic.php
Create an Excel file (.xlsx) [Solved] - XYplorer Beta Club
December 4, 2022 - RalphM wrote: โ†‘04 Dec 2022 14:42 The XY way is to use the "Edit/New Items" menu instead, but you need to place an appropriately formatted file in the right place first for it to show up in the menu. While this might seem trouble at first, it gives you the added ability to have various different Excel or whatever files stored there as templates (Tip: it even allows for whole folder structures to be stored there) for future use.
Top answer
1 of 4
9
Hi , I was able to acheive this by bringing to Excel (.xlsx) instead of csv.Just below copy paste the code, and u will have excel created in the specified record.Script: ยท var rows_data = ""; ยท var columns_of_excel = ""; ยท columns_of_excel += ""; ยท // Define the Styles for bold headers ยท columns_of_excel += ""; ยท columns_of_excel += ""; ยท columns_of_excel += ""; ยท columns_of_excel += ""; ยท columns_of_excel += ""; ยท // Define the headers and apply the bold style ยท columns_of_excel += ""; ยท columns_of_excel += "Number"; ยท columns_of_excel += "Opened"; ยท columns_of_excel += "Short Description"; ยท columns_of_excel += "Created"; ยท columns_of_excel += "Caller"; ยท columns_of_excel += ""; ยท // Retrieve the incidents for the 'software' category ยท var gr = new GlideRecord('incident'); ยท gr.addQuery('category', 'software'); ยท gr.query(); ยท while (gr.next()) { ยท     rows_data += ""; ยท     rows_data += "" + gr.number + ""; ยท     rows_data += "" + gr.opened_at + ""; ยท     rows_data += "" + gr.short_description + ""; ยท     rows_data += "" + gr.sys_created_on + ""; ยท     rows_data += "" + gr.caller_id.getDisplayValue() + ""; ยท     rows_data += ""; ยท } ยท // Close the XML structure ยท columns_of_excel += rows_data; ยท columns_of_excel += "
"; ยท columns_of_excel += ""; ยท columns_of_excel += ""; ยท // Combine the columns (headers) and rows data ยท var columns_and_rows = columns_of_excel; // complete data including headers and rows ยท // Get the current user record for attaching the file ยท var user = new GlideRecord('sys_user'); ยท user.addQuery('sys_id', gs.getUserID()); ยท user.query(); ยท user.next(); ยท // Create the attachment ยท var attachment = new GlideSysAttachment(); ยท attachment.write(user, "Incident software.xls", "application/vnd.ms-excel", columns_and_rows); ยท gs.print("Excel file exported and attached successfully. Please check.");
2 of 4
0
Hi @Gustavo Olivei1 ,Have a look below thread, ยท https://www.servicenow.com/community/itsm-forum/how-can-i-export-data-into-excel-xlsx-via-script/m-p... ยท   ยท Thank you,
Find elsewhere
๐ŸŒ
Techwalla
techwalla.com โ€บ tech support โ€บ how to
How to Create XLS Files | Techwalla
March 31, 2015 - Video of the Day ยท Click on "File." Select "Save As." Enter the name that you would like for your Excel spreadsheet to be saved as. Advertisement ยท Tech Support ยท How to Convert XLS Files to XLSX Files in Microsoft Excel ยท
๐ŸŒ
Microsoft Support
support.microsoft.com โ€บ en-us โ€บ office โ€บ saving-xls-to-xlsx-xlsm-d74fe848-d887-4e63-9638-8f752cd743a2
Saving xls to xlsx xlsm | Microsoft Support
Open the workbook > Navigate to File > Save As > Browse โ€“ which will open the below window. Make sure you are in the right path to save the workbook > Choose Excel Workbook (*.xlsx) under Save as type > Select Save.
๐ŸŒ
Libxlsxwriter
libxlsxwriter.github.io
libxlsxwriter: Creating Excel files with C and libxlsxwriter
Libxlsxwriter is a C library for creating Excel XLSX files. ... Libxlsxwriter is a C library that can be used to write text, numbers, formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.
๐ŸŒ
Lucee Dev
dev.lucee.org โ€บ t โ€บ generate-xlsx-files โ€บ 13921
Generate XLSX files - dev - Lucee Dev
May 30, 2024 - Hello, I have a website where HTML tables are created dynamically. Some cells are also linked. Now I would like to offer an export function with which the tables can be saved as xlsx files. I have now read that Lucee does not offer spreadsheet manipulation. So something like SpreadsheetMergeCells ...
๐ŸŒ
Techwalla
techwalla.com โ€บ tech support โ€บ how to
How to Convert XLS Files to XLSX Files in Microsoft Excel | Techwalla
February 9, 2017 - Select "Excel Workbook" from the menu. Select the location where you want to save your file, give it a name and click "Save." Your file will now be saved with the file extension .xlsx instead of .xls.
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ office โ€บ open-xml โ€บ spreadsheet โ€บ how-to-create-a-spreadsheet-document-by-providing-a-file-name
How to: Create a spreadsheet document by providing a file name | Microsoft Learn
January 9, 2025 - ' By default, AutoSave = true, Editable = true, and Type = xlsx. Using spreadsheetDocument As SpreadsheetDocument = SpreadsheetDocument.Create(filepath, SpreadsheetDocumentType.Workbook) When you have created the Excel document package, you can add parts to it.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-create-and-write-on-excel-file-using-xlsxwriter-module
Create and Write on Excel File using xlsxwriter Module - Python - GeeksforGeeks
July 11, 2025 - Workbook() creates a new Excel file. add_worksheet() adds a new worksheet to the workbook. write(cell, value) writes values to specific cells like 'A1', 'B1', etc. ... This creates a single worksheet with text in the first row from columns A ...
Top answer
1 of 10
20

Since this question seems to be rather: "What is the most lightweight way creating Office Open XML files for Excel (*.xlsx)?", I will providing an example which does not need any libraries except the default java.lang, java.io and java.util.zip.

A *.xlsx file is nothing else than a ZIP archive containing XML files and other files in a directory structure. So all we need is a possibility for creating, reading and writing ZIP archives and creating, reading and writing XML files. For the ZIP part I am using java.util.zip and for the XML part I am using string manipulation. This, creating and manipulating XML via string manipulation, is not the most recommended way for manipulating XML but it is the most lightweight way since it does not needs any additional XML libraries.

Complete example:

import java.io.OutputStream;
import java.io.ByteArrayOutputStream;

import java.util.zip.*;

public class CreateXLSXFromScratch {

 //some static parts of the XLSX file:

 static String content_types_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\"><Default ContentType=\"application/vnd.openxmlformats-package.relationships+xml\" Extension=\"rels\"/><Default ContentType=\"application/xml\" Extension=\"xml\"/><Override ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\" PartName=\"/docProps/app.xml\"/><Override ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\" PartName=\"/docProps/core.xml\"/><Override ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml\" PartName=\"/xl/sharedStrings.xml\"/><Override ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\" PartName=\"/xl/styles.xml\"/><Override ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\" PartName=\"/xl/workbook.xml\"/><Override ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\" PartName=\"/xl/worksheets/sheet1.xml\"/></Types>";

 static String docProps_app_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\"><Application>" + "Created Low level From Scratch" + "</Application></Properties>";

 static String docProps_core_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><dcterms:created xsi:type=\"dcterms:W3CDTF\">" + java.time.Instant.now().truncatedTo(java.time.temporal.ChronoUnit.SECONDS).toString() + "</dcterms:created><dc:creator>" + "Axel Richter from scratch" + "</dc:creator></cp:coreProperties>";

 static String _rels_rels_xml  = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Target=\"xl/workbook.xml\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\"/><Relationship Id=\"rId2\" Target=\"docProps/app.xml\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\"/><Relationship Id=\"rId3\" Target=\"docProps/core.xml\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\"/></Relationships>";

 static String xl_rels_workbook_xml_rels_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\"><Relationship Id=\"rId1\" Target=\"sharedStrings.xml\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings\"/><Relationship Id=\"rId2\" Target=\"styles.xml\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\"/><Relationship Id=\"rId3\" Target=\"worksheets/sheet1.xml\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\"/></Relationships>";

 static String xl_sharedstrings_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sst count=\"0\" uniqueCount=\"0\" xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"/>"; 

 static String xl_styles_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><numFmts count=\"0\"/><fonts count=\"1\"><font><sz val=\"11.0\"/><color indexed=\"8\"/><name val=\"Calibri\"/><family val=\"2\"/><scheme val=\"minor\"/></font></fonts><fills count=\"2\"><fill><patternFill patternType=\"none\"/></fill><fill><patternFill patternType=\"darkGray\"/></fill></fills><borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs><cellXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/></cellXfs></styleSheet>";

 static String xl_workbook_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"><workbookPr date1904=\"false\"/><bookViews><workbookView activeTab=\"0\"/></bookViews><sheets><sheet name=\"" + "Sheet1" + "\" r:id=\"rId3\" sheetId=\"1\"/></sheets></workbook>";

 static String xl_worksheets_sheet1_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"><dimension ref=\"A1\"/><sheetViews><sheetView workbookViewId=\"0\" tabSelected=\"true\"/></sheetViews><sheetFormatPr defaultRowHeight=\"15.0\"/><sheetData/><pageMargins bottom=\"0.75\" footer=\"0.3\" header=\"0.3\" left=\"0.7\" right=\"0.7\" top=\"0.75\"/></worksheet>";

 public static void main(String[] args) throws Exception {

  // result goes into a ByteArrayOutputStream
  ByteArrayOutputStream resultout = new ByteArrayOutputStream();

  // needed objects
  ZipEntry zipentry = null;
  byte[] data = null;

  // create ZipOutputStream
  ZipOutputStream zipout = new ZipOutputStream(resultout);

  // create the static parts of the XLSX ZIP file:

  zipentry = new ZipEntry("[Content_Types].xml");
  zipout.putNextEntry(zipentry);
  data = content_types_xml.getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  zipentry = new ZipEntry("docProps/app.xml");
  zipout.putNextEntry(zipentry);
  data = docProps_app_xml.getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  zipentry = new ZipEntry("docProps/core.xml");
  zipout.putNextEntry(zipentry);
  data = docProps_core_xml.getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  zipentry = new ZipEntry("_rels/.rels");
  zipout.putNextEntry(zipentry);
  data = _rels_rels_xml.getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  zipentry = new ZipEntry("xl/_rels/workbook.xml.rels");
  zipout.putNextEntry(zipentry);
  data = xl_rels_workbook_xml_rels_xml.getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  zipentry = new ZipEntry("xl/sharedStrings.xml");
  zipout.putNextEntry(zipentry);
  data = xl_sharedstrings_xml.getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  zipentry = new ZipEntry("xl/styles.xml");
  zipout.putNextEntry(zipentry);
  data = xl_styles_xml.getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  zipentry = new ZipEntry("xl/workbook.xml");
  zipout.putNextEntry(zipentry);
  data = xl_workbook_xml.getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  // preparing the sheet data:

  Object[][] sheetData = new Object[][] {
   {"Text", "Value", "Formula"},
   {"Text1", 1.23456, "=SIN(B2)"},
   {"Text2", 2.34567, "=SQRT(B3)"},
   {"Text3", 123.456, "=B4/10"}
  };
  String sheetdata = "<sheetData>";
  int r = 0;
  char c = 'A'; --c;
  for (Object[] rowData : sheetData) {
   sheetdata += "<row r=\"" + ++r + "\">";
   c = 'A'; --c;
   for (Object cellData : rowData) {
    sheetdata += "<c r=\"" + Character.toString(++c) + r + "\"";
    if (cellData instanceof String && ((String)cellData).startsWith("=")) {
     sheetdata += "><f>" + ((String)cellData).replace("=", "") + "</f></c>";
    } else if (cellData instanceof String) {
     sheetdata += " t=\"inlineStr\"><is><t>" + ((String)cellData) + "</t></is></c>";
    } else if (cellData instanceof Double) {
     sheetdata += "><v>" + ((Double)cellData) + "</v></c>";
    }
   }
   sheetdata += "</row>";
  }
  sheetdata += "</sheetData>";

  // get the static sheet xml into a buffer for further processing
  StringBuffer xl_worksheets_sheet1_xml_buffer = new StringBuffer(xl_worksheets_sheet1_xml);

  // get position of the <dimension ref=\"A1\"/> in the static xl_worksheets_sheet1_xml
  int dimensionstart = xl_worksheets_sheet1_xml_buffer.indexOf("<dimension ref=\"A1\"/>");
  // replace the <dimension ref=\"A1\"/> with the new dimension
  xl_worksheets_sheet1_xml_buffer = xl_worksheets_sheet1_xml_buffer.replace(
   dimensionstart, 
   dimensionstart + "<dimension ref=\"A1\"/>".length(), 
   "<dimension ref=\"A1:" + Character.toString(c) + r + "\"/>");

  // get position of the <sheetData/> in the static xl_worksheets_sheet1_xml
  int sheetdatastart = xl_worksheets_sheet1_xml_buffer.indexOf("<sheetData/>");
  // replace the <sheetData/> with the prepared sheet date string
  xl_worksheets_sheet1_xml_buffer = xl_worksheets_sheet1_xml_buffer.replace(
   sheetdatastart, 
   sheetdatastart + "<sheetData/>".length(), 
   sheetdata);

  // create the xl/worksheets/sheet1.xml
  zipentry = new ZipEntry("xl/worksheets/sheet1.xml");
  zipout.putNextEntry(zipentry);
  data = xl_worksheets_sheet1_xml_buffer.toString().getBytes();
  zipout.write(data, 0, data.length);
  zipout.closeEntry();

  zipout.finish();

  // now ByteArrayOutputStream resultout contains the XLSX file data

  // writing this data into a file
  try (java.io.FileOutputStream fileout = new java.io.FileOutputStream("test.xlsx")) {
   resultout.writeTo(fileout);
   resultout.close();
  }

 }
}
2 of 10
16

First answer: do it server-side.

If that's not possible, just use JExecelAPI - pretty much everything that reads xlsx files reads xls files too.

Every other Excel library is going to be way too big.

Another thought - write csv files, either manually, or with one of the many csv libraries available. Again, most applications that read Excel files read csv files too.

Top answer
1 of 1
13

I highly recommend John McNamara's modules. He uploaded a new Python module called XlsxWriter for creating XLSX files to PyPi that I packaged for Debian and Ubuntu.

It is a port of a Perl module that he wrote called Excel::Writer::XLSX which is a extension of another Perl module called Spreadsheet::WriteExcel.

python3-xlsxwriter (python-xlsxwriter for python 2.x)

XlsxWriter is a Python module for writing files in the Excel 2007+ XLSX file format.

It can be used to write text, numbers, and formulas to multiple worksheets and it supports features such as formatting, images, charts, page setup, autofilters, conditional formatting and many others.

XlsxWriter has some advantages over the alternative Python modules for writing Excel files:

  • It supports more Excel features than any of the alternative modules.
  • It has a high degree of fidelity with files produced by Excel. In most cases the files produced are 100% equivalent to files produced by Excel.
  • It has extensive documentation, example files and tests.
  • It is fast and can be configured to use very little memory even for very large output files.
  • Integration with Pandas (Python Data Analysis Library).

A simple example of some of the features of the XlsxWriter Python module:

#Copyright 2013-2014, John McNamara, [email protected]
import xlsxwriter

# Create an new Excel file and add a worksheet.
workbook = xlsxwriter.Workbook('demo.xlsx')
worksheet = workbook.add_worksheet()

# Widen the first column to make the text clearer.
worksheet.set_column('A:A', 20)

# Add a bold format to use to highlight cells.
bold = workbook.add_format({'bold': True})

# Write some simple text.
worksheet.write('A1', 'Hello')

# Text with formatting.
worksheet.write('A2', 'World', bold)

# Write some numbers, with row/column notation.
worksheet.write(2, 0, 123)
worksheet.write(3, 0, 123.456)

# Insert an image.
worksheet.insert_image('B5', 'logo.png')

workbook.close()

Visit this page for a full list of XlsxWriter examples.

libexcel-writer-xlsx-perl

The Excel::Writer::XLSX module can be used to create an Excel file in the 2007+ XLSX format.

Multiple worksheets can be added to a workbook and formatting can be applied to cells. Text, numbers, and formulas can be written to the cells.

Excel::Writer::XLSX uses the same interface as the Spreadsheet::WriteExcel module which produces an Excel file in binary XLS format.

Excel::Writer::XLSX supports all of the features of Spreadsheet::WriteExcel and in some cases has more functionality. For more details see Compatibility with Spreadsheet::WriteExcel.

The main advantage of the XLSX format over the XLS format is that it allows a larger number of rows and columns in a worksheet.

The XLSX file format also produces much smaller files than the XLS file format.

To write a string, a formatted string, a number and a formula to the first worksheet in an Excel workbook called perl.xlsx:

# reverse ('(c)'), March 2001, John McNamara, [email protected]
use Excel::Writer::XLSX;

# Create a new Excel workbook
my $workbook = Excel::Writer::XLSX->new( 'perl.xlsx' );

# Add a worksheet
$worksheet = $workbook->add_worksheet();

#  Add and define a format
$format = $workbook->add_format();
$format->set_bold();
$format->set_color( 'red' );
$format->set_align( 'center' );

# Write a formatted and unformatted string, row and column notation.
$col = $row = 0;
$worksheet->write( $row, $col, 'Hi Excel!', $format );
$worksheet->write( 1, $col, 'Hi Excel!' );

# Write a number and a formula using A1 notation
$worksheet->write( 'A3', 1.2345 );
$worksheet->write( 'A4', '=SIN(PI()/4)' );

Visit this page for a full list of Excel::Writer::XLSX examples.

๐ŸŒ
Adobe
adobe.com โ€บ acrobat โ€บ resources โ€บ document-files โ€บ xlsx.html
XLSX file: How to open, view, or edit | Adobe Acrobat
Learn how to create, open, and edit XLSX files. ... Millions of users rely on Excel to manage personal finances, track project progress at work, and manage their kidsโ€™ sports schedules in a single view.