OiO.lk Blog javascript Creating CSV string without plugin
javascript

Creating CSV string without plugin


I am trying to let the user download a list of filtered members from our app.
I’ve done a much more complicated CSV String which works fine but for some reason I cannot get this one to work.

The code is:

  function getCSVString(){
    return ['nom', 'telèfon', 'email'].join(',') + '\n'
    + filteredMembers.value.map(member => {
      return [member.nom, member.telèfon, member.email].join(',') + '\n'
    })
  }

I have tried so many variants, with some ‘\r\n’ or the joins somewhere else, and downloaded 42 test files already, but the closest I get looks like this, with a stupid white space after the first line that shifts everything:

Excel table with a stupid whitespace

What am I not seeing???

Thank you in advance!!!



You need to sign in to view this answers

Exit mobile version