Skip to content

ExcelToJson is a simple and reliable PHP library that allows developers to quickly convert Excel spreadsheets into JSON format. It supports both .xls and .xlsx files and handles empty headers gracefully by automatically generating keys.

License

Notifications You must be signed in to change notification settings

frantzleyadolphe/excel-to-json-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Excel to JSON for PHP

ExcelToJson is a simple and reliable PHP library that allows developers to quickly convert Excel spreadsheets into JSON format. It supports both .xls and .xlsx files and handles empty headers gracefully by automatically generating keys.

With optional output to a JSON file, it’s perfect for APIs, data migration, reporting, or any project where you need to transform Excel data into structured JSON. Designed for PHP 8+, it integrates seamlessly into your projects and comes with PHPUnit tests for easy validation.

Key Features:

----> Convert Excel files to JSON effortlessly.

----> Supports .xls and .xlsx.

----> Auto-generates keys for empty headers.

----> Pretty-printed JSON with Unicode support.

----> Optional JSON output to a file (Will be on the Next Update).

----> Compatible with modern PHP (8.0+).

Installation

Require the package via Composer:

composer require frantzley/excel-to-json

Usage

<?php

require 'vendor/autoload.php';

use Frantzley\ExcelToJson\ExcelToJson;

$converter = new ExcelToJson();

// Convert Excel file to JSON
$json = $converter->convert('/path/to/your/file.xlsx'); // Replace with your file path ( ranplase li pa chemen kote fichye ou an lokalize an )
echo $json;

Testing

Run unit tests with PHPUnit:

vendor/bin/phpunit tests

License

MIT

About

ExcelToJson is a simple and reliable PHP library that allows developers to quickly convert Excel spreadsheets into JSON format. It supports both .xls and .xlsx files and handles empty headers gracefully by automatically generating keys.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages