-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added to excelreader and fixed some minor naming issues
- Loading branch information
1 parent
00249ed
commit d7702dd
Showing
3 changed files
with
16 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
,nick,nick-Kubuntu,25.06.2022 15:42,file:///home/nick/.config/libreoffice/4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const xlsx = require('xlsx'); | ||
const System = require('./system'); | ||
|
||
const myfilepath = path.join(__dirname, 'Inventory', 'samplepc1234.xlsx'); | ||
|
||
function readInventoryFile(filepath) { | ||
const workbook = xlsx.readFileSync(filepath); | ||
const sheetNames = workbook.SheetNames; | ||
const data = workbook.Sheets[sheetNames[0]]; | ||
console.log(data); | ||
let workbook = xlsx.readFileSync(filepath); | ||
let sheetNames = workbook.SheetNames; | ||
let sheetData = workbook.Sheets[sheetNames[0]]; | ||
|
||
//Here is where we use known cell locations of the specs needed to build the systems file | ||
let serialNum = sheetData.D1.v; | ||
let model = sheetData.D2.v; | ||
let OS = sheetData.D3.v; | ||
let price = sheetData.D4.v; | ||
let specs = [sheetData.D5.v, sheetData.D6.v, sheetData.D7.v, sheetData.D8.v]; | ||
|
||
return new System(serialNum, model, OS, price, specs); | ||
} | ||
|
||
|
||
readInventoryFile(myfilepath); | ||
//console.log('yo'); | ||
console.log(readInventoryFile(myfilepath)); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters