Parse CSV data to array
yakuter opened this issue · comments
Is your feature request related to a problem? Please describe.
Now import function is added ass seen in the picture. User should import csv files with this.
I am going to encrypt and add values to database however I need someone to parse this csv content line by line as array. The import handle function is in /src/renderer/App.vue like this:
onImport() {
dialog.showOpenDialog({ properties: ['openFile'] }, files => {
if (files.length === 0) return
try {
const fileContent = fs.readFileSync(files[0]).toString()
// TODO: Parse fileContent (CSV data) to array
console.log(fileContent)
} catch (error) {
console.log(error)
}
})
}
Describe the solution you'd like
Example CSV content is here
https://github.com/passwall/passwall-server/blob/master/example.csv
Can someone parse and give me the values of CSV lines as array and javascript variables?
Thank you.
Hey @umutbozdag or @bufgix do you have time for this?
Is something like this okay? @yakuter
Or this?
The second model (mapping style) is what I need. By the way the URL, Username and Password fields can be changed according to the first line (column names) of CSV file. So, can we create this map dynamically according to CSV file? If not the static model you show is OK.
Is something like this okay? @yakuter
Or this?
The second model (mapping style) is what I need. By the way the URL, Username and Password fields can be changed according to the first line (column names) of CSV file. So, can we create this map dynamically according to CSV file? If not the static model you show is OK.
Yeah actually i am creating fields by header (column) names dynamically @yakuter
Great. Assigned you now @umutbozdag