Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript download csv

let csvContent = "data:text/csv;charset=utf-8,";
  rows.forEach(function (rowArray) {
    for (var i = 0, len = rowArray.length; i < len; i++) {
      if (typeof (rowArray[i]) == 'string')
        rowArray[i] = rowArray[i].replace(/<(?:.|
)*?>/gm, '');
      rowArray[i] = rowArray[i].replace(/,/g, '');
    }

    let row = rowArray.join(",");
    csvContent += row + "
"; // add carriage return
  });
  var encodedUri = encodeURI(csvContent);
  var link = document.createElement("a");
  link.setAttribute("href", encodedUri);
  link.setAttribute("download", "fileName.csv");
  document.body.appendChild(link);
  link.click();
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript display 2 number after comma 
Javascript :: javascript beforeunload 
Javascript :: get query params from url javascript 
Javascript :: could not resolve module fs react native 
Javascript :: javascript get element by custom attribute 
Javascript :: Get React Native View width and height 
Javascript :: jquery validation phone number 
Javascript :: vue js cdn link 
Javascript :: js replace all 
Javascript :: regex contains string in end 
Javascript :: node js query get :id param 
Javascript :: chart js stacked bar group 
Javascript :: convert date to millisecond in javascript 
Javascript :: remove key from object array javascript 
Javascript :: nodejs wait function 
Javascript :: check date format javascript 
Javascript :: open a particular slide on click button in owl carousel 
Javascript :: throttling function in javascript 
Javascript :: discord.js add button to message 
Javascript :: maximum sum subarray javascript 
Javascript :: how to make option selected edit in jquery 
Javascript :: react navigation navigator types 
Javascript :: to capital case javascript 
Javascript :: tabuada js 
Javascript :: json to csv nodejs 
Javascript :: nuxt-link name params 
Javascript :: run from build react 
Javascript :: javascript push array into array 
Javascript :: javascript write all the prime numbers from 1 to 100 
Javascript :: toaster cdn 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =