PHPExcelFormatter is class to make getting data from Excel documents simpler.

Overview

Actions Status Coverage Status Latest Stable Version Total Downloads License

PHPExcelFormatter

PHPExcelFormatter is class to make getting data from Excel documents simpler.

  • Read columns what you really need
  • Set column names for documents what dosen't have column names on first row
  • Set your DB field names for columns
  • Retrieve data in array or MySQL query format
  • Greate for importing files and then letting user to connect document columns with your DB fields :) (example coming)

Install

composer require renekorss/phpexcelformatter

Usage

// Require needed files
require __DIR__ . '/vendor/autoload.php';

use RKD\PHPExcelFormatter\PHPExcelFormatter;
use RKD\PHPExcelFormatter\Exception\PHPExcelFormatterException;

try {
  // Load file
  $formatter = new PHPExcelFormatter('example1.xls');

  // Output columns array (document must have column names on first row)
  $formatterColumns = array(
    'username' => 'username',
    'phone'    => 'phone_no',
    'email'    => 'email_address'
  );

  // Output columns array (document dosen't have column names on first row)
  // Skip fourth column (age) (third in array), because we don't need that data
  // NOTE: if document dosen't have column names on first line, second parameter for PHPExcelFormatter should be $readColumns = false, otherwise it will skip first line of data
  $formatterColumns = array(
    'username',
    'email_address',
    'phone',
    4 => 'sex'
  );

  // Set our columns
  $formatter->setFormatterColumns($formatterColumns);

  // Output as array
  $output = $formatter->output('a');
  // OR
  // $output = $formatter->output('array');

  // Print array
  echo '
'.print_r($output, true).'
'
; // Set MySQL table $formatter->setMySQLTableName('users'); // Output as mysql query $output = $formatter->output('m'); // OR // $output = $formatter->output('mysql'); // Print mysql query echo '
'.print_r($output, true).'
'
; } catch (PHPExcelFormatterException $e) { echo 'Error: '.$e->getMessage(); }

View examples

License

PHPExcelFormatter is licensed under MIT

You might also like...
ExcelAnt - Simple yet powerful Excel manipulation library for PHP 5.4+

ExcelAnt is an Excel manipulation library for PHP 5.4. It currently works on top of PHPExcel. If you want to add / use another library, feel free to fork and contribute !

A pure PHP library for reading and writing word processing documents

Master: Develop: PHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. Th

A pure PHP library for reading and writing presentations documents
A pure PHP library for reading and writing presentations documents

Branch Master : Branch Develop : PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation fi

CSV data manipulation made easy in PHP

CSV Csv is a simple library to ease CSV parsing, writing and filtering in PHP. The goal of the library is to be powerful while remaining lightweight,

A PHP spreadsheet reader (Excel XLS and XLSX, OpenOffice ODS, and variously separated text files) with a singular goal of getting the data out, efficiently

spreadsheet-reader is a PHP spreadsheet reader that differs from others in that the main goal for it was efficient data extraction that could handle l

Parse and retrieve data from old format Excel XLS files. MS Excel 97 workbooks PHP reader.

SimpleXLS class 0.9.15 Parse and retrieve data from old Excel .XLS files. MS Excel 97-2003 workbooks PHP reader. PHP BIFF reader. No additional extens

Extend Laravel PHP framework to make working with Aiven databases simpler

Aiven Commands for Laravel ✨ Add some Aiven magic to your Laravel project ✨ This Laravel package provides some aiven commands for artisan to help with

Merge Excel Files to single excel file per columns

Merge Excel Files to single excel file per columns

Composer Plugin for simpler registration of Rector extension configs

Rector Extension Installer Composer plugin for automatic installation of Rector extensions. Usage composer require --dev rector/extension-installer In

Simpler Url Shortener for Laravel
Simpler Url Shortener for Laravel

Laravel Url Shortener Install composer require magarrent/laravel-url-shortener Run migrations: php artisan migrate Configuration If you want to config

This is a simpler way to decode the Green Pass QR-code in your PHP application. Infopanel is a simple tool getting some information from source. It works basically like a slider that shows only title, image, a little bit description and QR-Code for links.
Infopanel is a simple tool getting some information from source. It works basically like a slider that shows only title, image, a little bit description and QR-Code for links.

Infopanel is a simple tool getting some information from source. It works basically like a slider that shows only title, image, a little bit description and QR-Code for links. It has its own GUI for the editing. The GUI provides a very simple role concept. This tool can be used for digital signage, Information panels, News or Events or similar.

Read-only WebDAV server written in php8.0; supports browsing archives and GETting files in encodings other than what's on disk

Best Read-only WebDAV Server: TODO Features and notes of implementation Keeping generated files in a place that nginx can find them (2 ways to do this

Prevents development packages from being added into require and getting into production environment.

production-dependencies-guard Prevents development packages from being added into require and getting into production environment. In practical field

Library for getting countries info from restcountries.com

librestcountries Library for getting countries info from restcountries.com Description Library for getting countries info from restcountries.com Getti

Source for "Getting Started with TALL stack" post

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Data import to excel without any package

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Make any class queue aware in a Laravel app
Make any class queue aware in a Laravel app

Make any class queue aware This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. Support us We in

A Formatter Class for Laravel 4 based on FuelPHP's Formatter Class

Changelog Update support for Laravel 6 & phpunit 8 Update composer.json Upgrade to PSR-4 add parameter newline, delimiter, enclosure, and escape to ex

Releases(3.0.0)
Owner
Rene Korss
Full stack developer. Love PHP, Javascript, Linux, AWS, Laravel, React Native.
Rene Korss
Merge Excel Files to single excel file per columns

Merge Excel Files to single excel file per columns

Max Base 3 Apr 26, 2021
Data import to excel without any package

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Dilshodbek 2 May 30, 2022
Simple yet powerful Excel manipulation library for PHP 5.4+

| | \ / \_/ __ /^\ __ ' `. \_/ ,' ` \/ \/ _,--./| |\.--._ _,' _.-\_/-._ `._ | / \ | |

Wisembly 68 Sep 20, 2022
🚀 Supercharged Excel exports and imports in Laravel

Supercharged Excel exports and imports A simple, but elegant Laravel wrapper around PhpSpreadsheet exports and imports. Quickstart · Documentation · V

Maatwebsite 11.2k Jan 4, 2023
🦉 Fast Excel import/export for Laravel

Fast Excel import/export for Laravel, thanks to Spout. See benchmarks below. Quick start Install via composer: composer require rap2hpoutre/fast-excel

Raphaël Huchet 1.7k Jan 8, 2023
an excel export/import tool for laravel based on php-xlswriter

Laravel-xlswriter 一款基于xlswriter的laravel扩展包 php-xlswriter是一款高性能的excel读写扩展,laravel-xlswriter基于该扩展做了封装,旨在提供一个便于使用的xlswriter的laravel工具包。 目前laravel-xlswrit

lysice 54 Dec 3, 2022
Simplexcel.php - Easily read / parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc spreadsheet tabular file formats

Simple Excel Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats For further deatails see the GitHuib P

Faisal Salman 550 Dec 27, 2022
Laravel Excel Export & Import example

Laravel Excel Export & Import example It's pretty easy to export to Excel and import from Excel, with great Laravel Excel package. This package superc

Syed Arsalan Ahmed 1 Oct 26, 2021
You can convert any table to CSV/EXCEL file.

Convert MySQL to EXCEL You can convert any table to CSV/EXCEL file by this code. In this repository I've used Link1 and Link2 . Simply edit config.php

Arsalan 1 Dec 25, 2021
PhpSpreadsheet - a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc

PhpSpreadsheet PhpSpreadsheet is a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file f

PHPOffice 11.8k Dec 31, 2022