26 lines
		
	
	
		
			618 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			618 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| namespace nulib\tools;
 | |
| 
 | |
| use nulib\app\cli\Application;
 | |
| use nulib\ext\tab\SsBuilder;
 | |
| use nulib\ext\tab\SsReader;
 | |
| use nulib\file;
 | |
| use nulib\os\path;
 | |
| use nulib\ValueException;
 | |
| 
 | |
| class Csv2xlsxApp extends Application {
 | |
|   private $args;
 | |
| 
 | |
|   function main() {
 | |
|     $input = ValueException::check_null($this->args[0] ?? null);
 | |
|     $inputname = path::filename($input);
 | |
|     $output = path::ensure_ext($inputname, ".xlsx", ".csv");
 | |
| 
 | |
|     $reader = SsReader::with($input);
 | |
|     $builder = SsBuilder::with($output);
 | |
|     $builder->writeAll($reader);
 | |
|     $builder->build();
 | |
|     $builder->copyTo(file::writer($output), true);
 | |
|   }
 | |
| }
 |