[2201.13.x] Add Ballerina By Example samples for the xlsx library - #6422
[2201.13.x] Add Ballerina By Example samples for the xlsx library#6422YasanPunch wants to merge 2 commits into
Conversation
…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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|



Purpose
Backport of #6417 (merged to master) to
2201.13.x. BBE docs only — thestdlibAvroVersionbump included in #6417 is intentionally excluded, as2201.13.xalready pins avro 1.2.2.Adds Ballerina By Example (BBE) samples for the
ballerina/xlsxlibrary, 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 rowrecords-to-xlsx— write a record array to a named sheetxlsx-tables— create an Excel table from records and read it back by table namexlsx-to-records-advanced—@xlsx:Nameheader mapping,caseInsensitiveHeaders,rowCountThe samples import
ballerina/xlsx, which is Central-distributed rather than bundled in the distribution. Following the cdc samples' precedent, the entries keepverifyBuild: true(CI compiles each sample, resolving the module from Central) withverifyOutput: false(abal runwould emit Central pull-progress output that breaks output matching) anddisablePlayground: true.Learn page previews
Rendered with the
ballerina-dev-websiterepo'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:
Parse Excel file to records:
Write records to Excel file:
Work with Excel tables:
Parse Excel file to records - advanced:
Automation tests
CI compiles all four samples via
:ballerina:testExamples(verifyBuild: true), resolvingballerina/xlsxfrom Central. Outputs are not CI-verified (verifyOutput: false); they were captured from real runs againstballerina/xlsx:1.0.1on bal 2201.13.5 — the same line this branch targets.Samples
Four new BBE directories under
examples/, each with the standard.bal/.md/.metatags/.outset, registered inexamples/index.json.Security checks
🤖 Generated with Claude Code