Skip to content

performingdigital/exceltocsv

Repository files navigation

Excel to CSV Converter

A simple command-line tool built with Laravel Zero to convert Excel files to CSV format.

Features

  • Convert Excel files (.xlsx, .xls, .ods) to CSV format
  • Support for multiple sheets - creates separate CSV files for each sheet by default
  • Option to combine all sheets into a single CSV file
  • Custom output directory support
  • Clean error handling and user feedback

Installation

  1. Clone or download this project
  2. Install dependencies:
    composer install

Usage

Basic Usage

Convert an Excel file to CSV (creates separate files for each sheet):

php application excel:to-csv path/to/your/file.xlsx

This will create CSV files in the same directory as the input file:

  • file_Sheet1.csv
  • file_Sheet2.csv
  • etc.

Options

Custom Output Directory

Specify a custom output directory:

php application excel:to-csv path/to/your/file.xlsx --output=output/directory

Single File Output

Combine all sheets into a single CSV file:

php application excel:to-csv path/to/your/file.xlsx --single-file

When using --single-file, sheets are separated by empty lines and sheet headers.

Examples

# Convert Excel file to separate CSV files
php application excel:to-csv data.xlsx

# Convert to single CSV file
php application excel:to-csv data.xlsx --single-file

# Convert with custom output directory
php application excel:to-csv data.xlsx --output=converted

# Combine both options
php application excel:to-csv data.xlsx --single-file --output=converted

Supported Formats

  • Excel 2007+ (.xlsx)
  • Excel 97-2003 (.xls)
  • OpenDocument Spreadsheet (.ods)

Requirements

  • PHP 8.2+
  • Composer

Dependencies

  • laravel-zero/framework - Console application framework
  • phpoffice/phpspreadsheet - Excel file processing

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages