Skip to content

[2201.13.x] Add Ballerina By Example samples for the xlsx library - #6422

Open
YasanPunch wants to merge 2 commits into
ballerina-platform:2201.13.xfrom
YasanPunch:xlsx-bbe-2201.13.x
Open

[2201.13.x] Add Ballerina By Example samples for the xlsx library#6422
YasanPunch wants to merge 2 commits into
ballerina-platform:2201.13.xfrom
YasanPunch:xlsx-bbe-2201.13.x

Conversation

@YasanPunch

Copy link
Copy Markdown
Contributor

Purpose

Backport of #6417 (merged to master) to 2201.13.x. BBE docs only — the stdlibAvroVersion bump included in #6417 is intentionally excluded, as 2201.13.x already pins avro 1.2.2.

Adds Ballerina By Example (BBE) samples for the ballerina/xlsx library, covering the common Excel workflows: parsing sheets into records, writing records to sheets, working with Excel tables, and customizing parsing behavior.

Approach

Four new BBEs under a new "XLSX data" category (column 3, "Common libraries", alongside CSV/YAML data), cherry-picked from the master PR including all of its review-round changes:

  • xlsx-to-records — parse a sheet into an array of records via the header row
  • records-to-xlsx — write a record array to a named sheet
  • xlsx-tables — create an Excel table from records and read it back by table name
  • xlsx-to-records-advanced@xlsx:Name header mapping, caseInsensitiveHeaders, rowCount

The samples import ballerina/xlsx, which is Central-distributed rather than bundled in the distribution. Following the cdc samples' precedent, the entries keep verifyBuild: true (CI compiles each sample, resolving the module from Central) with verifyOutput: false (a bal run would emit Central pull-progress output that breaks output matching) and disablePlayground: true.

Learn page previews

Rendered with the ballerina-dev-website repo's own BBE generation and Next.js site against these examples (previews captured for #6417; the sample content here is identical).

Learn by Example landing page — "XLSX data" category under Common libraries:

Learn by Example landing page showing the XLSX data category

Parse Excel file to records:

Parse Excel file to records BBE page

Write records to Excel file:

Write records to Excel file BBE page

Work with Excel tables:

Work with Excel tables BBE page

Parse Excel file to records - advanced:

Parse Excel file to records advanced BBE page

Automation tests

CI compiles all four samples via :ballerina:testExamples (verifyBuild: true), resolving ballerina/xlsx from Central. Outputs are not CI-verified (verifyOutput: false); they were captured from real runs against ballerina/xlsx:1.0.1 on bal 2201.13.5 — the same line this branch targets.

Samples

Four new BBE directories under examples/, each with the standard .bal/.md/.metatags/.out set, registered in examples/index.json.

Security checks

  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets: yes

🤖 Generated with Claude Code

…brary

- Introduced new examples demonstrating how to parse Excel files into records and write records to Excel files.
- Added functionality for creating and manipulating Excel tables in memory.
- Included custom configurations for parsing Excel sheets with varying header names.
- Updated index.json to include new examples under the "Common libraries" category.
- Updated `index.json` to enable build verification for several examples.
- Added a new advanced example for parsing Excel files with custom configurations.
- Improved documentation for existing examples by including links to the xlsx module.
- Removed outdated examples related to user configurations and in-memory workbooks.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9080f6d9-0a5a-4af1-94ad-48ee7eff6077

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant