miranj / craft-sheets-to-tables
Adds a Twig function to convert Spreadsheets into HTML tables.
Installs: 1 759
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 1
Open Issues: 1
Type:craft-plugin
Requires
- php: ^7.2.5 || ^8.0
- craftcms/cms: ^3.0 || ^4.0 || ^5.0
- phpoffice/phpspreadsheet: ^1.5 || ^2.0
Requires (Dev)
- craftcms/phpstan: dev-main
- craftcms/rector: dev-main
README
Sheets to Tables
This Craft CMS plugin adds a Twig function to convert Spreadsheets into HTML tables.
Contents
Usage
To convert a spreadsheet file into an HTML <table>
, pass an craft\elements\Asset object as an argument to the sheetstotables( asset )
Twig function.
{% set spreadsheet = craft.assets.kind('excel').one() %} {{ sheetstotables(spreadsheet) }}
If the spreadsheet file contains multiple sheets, only the contents of the first sheet will be rendered as a table.
Supported file formats
- CSV
- Excel (.xlsx, .xls)
- Open Document Format (.ods)
- Other formats supported by PhpSpreadsheet
Installation
You can install this plugin from the Plugin Store or with Composer.
From the Plugin Store
Go to the Plugin Store in your project’s Control Panel and search for “Sheets to Tables”. Then click on the “Install” button in its modal window.
Using Composer
Open your terminal and run the following commands:
# go to the project directory
cd /path/to/project
# tell composer to use the plugin
composer require miranj/craft-sheets-to-tables
# tell Craft to install the plugin
./craft plugin/install sheets-to-tables
Requirements
This plugin requires Craft CMS 3, 4, or 5.
Brought to you by Miranj