XLSX转为CSV - 常规模式

优质
小牛编辑
143浏览
2023-12-01
putCSV(resource $handler): bool

resource $handler
$config = ['path' => './tests'];
$excel  = new \Vtiful\Kernel\Excel($config);
​
$filePath = $excel->fileName('tutorial.xlsx', 'TestSheet1')
    ->header(['Item', 'Cost'])
    ->data([
        ['Item_1', 'Cost_1', 10, 10.9999995],
    ])
    ->output();
​
// 写入方式打开,将文件指针指向文件末尾。
$fp = fopen('./tests/file.csv', 'a');
​
$csvResult = $excel->openFile('tutorial.xlsx')
    ->openSheet()
    ->putCSV($fp);