passwall / passwall-desktop

PassWall Desktop is the desktop client for PassWall Server written with Electron Vue.

Home Page:https://passwall.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.
Screen Shot 2020-07-15 at 23 03 36

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

example

Or this?

example2

Is something like this okay? @yakuter

example

Or this?

example2

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
example
Or this?
example2

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