forked from sheetjs/docs.sheetjs.com
		
	
		
			
	
	
		
			15 lines
		
	
	
		
			382 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			15 lines
		
	
	
		
			382 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
|  | const XLSX = require("./xlsx.full.min"); | ||
|  | 
 | ||
|  | /* tjs.args[1] is the first argument to the script */ | ||
|  | const filename = tjs.args[1]; | ||
|  | 
 | ||
|  | /* read and parse file */ | ||
|  | const data = await tjs.readFile(filename); | ||
|  | const wb = XLSX.read(data); | ||
|  | 
 | ||
|  | /* generate CSV of first sheet */ | ||
|  | const ws = wb.Sheets[wb.SheetNames[0]]; | ||
|  | const csv = XLSX.utils.sheet_to_csv(ws); | ||
|  | 
 | ||
|  | /* print to terminal */ | ||
|  | console.log(csv); |