1. Products
  2.   Spreadsheet
  3.   Perl
  4.   Excel-Writer-XLSX

Free Perl API to Create & Convert Excel Spreadsheets

Open Source Perl Excel Library that allows Excel XLSX Creation, Editing & Manipulation. It allows data Import/Export, Chart Generation, Formula support & so on.

Microsoft Excel is a powerful tool widely used for data manipulation, analysis, and reporting. When it comes to manipulating Excel files programmatically using Perl, the Excel-Writer-XLSX library stands out as a reliable and feature-rich solution. Excel-Writer-XLSX is an open source Perl module that enables the creation and manipulation of Excel files in the XLSX format, which is the default format used by Microsoft Excel since 2007. It provides software developers with a convenient set of tools and functions to generate, modify, and format Excel spreadsheets, making it an essential resource for automating data processing tasks.

The Excel-Writer-XLS Perl library opens up a world of possibilities for developers looking to interact with Excel files programmatically. There are several important features part of the library, such as handle Multiple worksheets, working with Strings and numbers, Cell formatting support, working with Formulas, insert and manage Images, working with Charts, Data validation support, Conditional formatting, insert & manage Tables, Rich string formats support, handle hyperlinks, Page set-up and printing options and many more.

Excel-Writer-XLSX is a versatile and easy to use Perl library that simplifies Excel file generation and manipulation tasks. The library supports creation of formulas within cells and provides several functions to set formulas using standard Excel syntax, allowing developers to perform calculations and automate data analysis within their Perl applications. Whether you need to generate reports, process large datasets, or integrate Excel functionality into your Perl applications, Excel-Writer-XLSX provides the necessary tools to streamline your workflow.

Previous Next

Getting Started with Excel-Writer-XLSX

The recommend way to install Excel-Writer-XLSX is using standard Perl procedure. Please use the following command for a smooth installation.

Install Excel-Writer-XLSX via CPAN

cpan Excel::Writer::XLSX 

You can also download it directly from GitHub.

Create & Manage Excel Spreadsheet via Perl

The open source Excel-Writer-XLSX library allows software developers to create and manipulate Excel spreadsheets inside their Perl applications. It allows the generation of new Excel spreadsheets from scratch with just a couple of lines of Perl code. It provides functions to define worksheets, set cell values, format cells, and apply various styling options such as font size, bold/italic, cell borders, background colors, and more. This flexibility allows for the creation of visually appealing and informative spreadsheets. The following example shows how software developers can create Excel spreadsheet and Populate the worksheet with data by specifying row and column indices using Perl commands.

How to Create Excel Files using Perl API?

use Excel::Writer::XLSX;

// initialize a new Excel workbook and add a worksheet:

my $workbook = Excel::Writer::XLSX->new('output.xlsx');
my $worksheet = $workbook->add_worksheet();

//Populate the worksheet with data by specifying row and column indices

$worksheet->write('A1', 'Hello');
$worksheet->write('A2', 'Excel');
$worksheet->write('B1', 'Welcome');
$worksheet->write('B2', 'to');
$worksheet->write('C1', 'excel-writer-xlsx'); 

Adding & Managing Charts in Spreadsheets via Perl

Visualizing data in the form of charts is a common requirement in Excel. The open source Excel-Writer-XLSX library offers support for creating various types of charts, including bar charts, line charts, pie charts, and more. Software Developers can specify the chart data range, customize chart appearance, and add titles, labels, and legends to enhance the visual representation of data. The following example demonstrates how to insert chart into an Excel worksheet using Perl code.

How to Add Chart into an Excel Worksheet via Perl Code?

 my $chart = $workbook->add_chart(type => 'column', embedded => 1);

    categories => '=Sheet1!$A$1:$A$3',
    values     => '=Sheet1!$B$1:$B$3',

$worksheet->insert_chart('C4', $chart);

Import & Export Data from Excel File

The open source Excel-Writer-XLSX library make it easy for software developers to import and export data from an Excel file inside Perl applications. The library supports seamless data import and export from various data sources. It can read data from arrays, hashes, database query results, and CSV files, making it convenient for populating Excel sheets with existing data. Similarly, it enables exporting data from Excel sheets to these formats, facilitating data extraction and integration into other systems.