Skip to content

📝 This is an app that uses the exceljs package to create or read CSV files

Notifications You must be signed in to change notification settings

CosmoRocket/node-exceljs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Exceljs

This is an app that uses the exceljs package to create or read CSV files

Routes

POST /upload

  • Handles file upload of CSV Files
  • Example html:
<html>
  <body>
    <form ref='uploadForm' 
      id='uploadForm' 
      action='http://localhost:7000/upload' 
      method='post' 
      encType="multipart/form-data">
        <input type="file" name="csvFile" />
        <input type='submit' value='Upload!' />
    </form>     
  </body>
</html>

Excel JS Functions

writeToCSV

// Array of column names
columns = [
  { header: 'Id', key: 'id', width: 10 },
  { header: 'Name', key: 'name', width: 32 },
  { header: 'D.O.B.', key: 'DOB', width: 10, outlineLevel: 1 }
]

// Array of data rows
data = [
  { id: 1, name: 'John Doe', dob: new Date(1970, 1, 1) },
  { id: 2, name: 'Jane Doe', dob: new Date(1965, 1, 7) },
  [3, 'Sam', new Date()],
  [4, 'Bob', new Date()], // row by array
  { id: 5, name: 'Barbara', dob: new Date() }
]

// Write to CSV File
writeToCsv ( 'filename.csv', 'sheet name', columns, data )

readFromCSV

readFromCsv ( 'filename.csv' )

About

📝 This is an app that uses the exceljs package to create or read CSV files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.6%
  • HTML 6.4%