LeKoala\ExcelImportExport\ExcelImportExport
Support class for the module
- Author: Koala
Synopsis
class ExcelImportExport
{
- // members
- public static bool $iterate_only_existing_cells = false;
- public static bool $use_old_calculated_value = false;
- public static boolean $process_headers = false;
- public static string $default_tmp_reader = 'Xlsx';
- public static integer $limit_exports = 1000;
- // methods
- public static array allFieldsForClass()
- public static array exportFieldsForClass()
- public static array importFieldsForClass()
- public static void sampleFileForClass()
- public static void getDefaultWriter()
- public static void outputHeaders()
- public static Spreadsheet generateDefaultSampleFile()
- public static string getValidExtensionsText()
- public static string getReaderForExtension()
- public static array getValidExtensions()
- public static void arrayToFile()
- public static void arrayToCsv()
- protected static Csv getCsvReader()
- public static array fileToArray()
- public static array excelToArray()
- public static string convertExcelDate()
- public static array excelToAssocArray()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
Members
public
- $default_tmp_reader — string
- $iterate_only_existing_cells
—
LeKoala\ExcelImportExport\bool
Setting this to false improve performance but may lead to skipped cells - $limit_exports — integer
- $process_headers
—
boolean
Some excel sheets need extra processing - $use_old_calculated_value
—
LeKoala\ExcelImportExport\bool
Useful if importing only one sheet or if computation fails
Methods
protected
public
- allFieldsForClass() — Get all db fields for a given dataobject class
- arrayToCsv() — Fast saving to csv
- arrayToFile() — Save content of an array to a file
- convertExcelDate()
- excelToArray() — Convert an excel file to an array
- excelToAssocArray() — Convert an excel file to an associative array
- exportFieldsForClass() — Get fields that should be exported by default for a class
- fileToArray() — Convert a file to an array
- generateDefaultSampleFile() — Generate a default import file with all field name
- getDefaultWriter()
- getReaderForExtension() — Extracted from PHPSpreadhseet
- getValidExtensions() — Get valid extensions
- getValidExtensionsText() — Show valid extensions helper (for uploaders)
- importFieldsForClass() — Get fields that can be imported by default for a class
- outputHeaders() — Output excel headers
- sampleFileForClass() — Output a sample file for a class