How to make a table using simple JavaScript csv export?

Asked By 0 points N/A Posted on -
qa-featured

Hi

I have to make a table for my website. I want to make it by using simple JavaScript csv export. I don't know how csv works with JavaScript.

Please show me the way if you can.

SHARE
Best Answer by Carr Heather
Answered By 10 points N/A #168860

How to make a table using simple JavaScript csv export?

qa-featured

Hello,

This is not possible to create table by Java Script CSV report, you need a schema of table. If your file has header row then you can create it by manually. There is a way to generate table.

Create a table using the .CSV file's header:

#!/bin/sh
# pass in the file name as an argument: ./mktable filename.csv
echo "create table $1 ( "
head -1 $1 | sed -e 's/,/ varchar(255),n/g'
echo " varchar(255) );"  

Hope this will work for you.

Best Answer
Best Answer
Answered By 5 points N/A #168861

How to make a table using simple JavaScript csv export?

qa-featured

Now I am using the jQuery Stand to be able to use the CSV Plugin. I've truly modified the actual popup in order that it enables the actual web browser to be able to download the CSV record. It was:

functionpopup(data) {

  vargenerator = window.open('', 'csv', 'height=400,width=600');

  generator.document.write('<html><head><title>CSV</title>');

  generator.document.write('</head><body >');

  generator.document.write('<textArea cols=70 rows=15 wrap="off" >');

  generator.document.write(data);

  generator.document.write('</textArea>');

  generator.document.write('</body></html>');

  generator.document.close();

  returntrue;

}

I've changed it to:

functionpopup(data) {

Window. w.location='da: a:text/c; v;charset=utf8,'+ encodeURIComponent(data);

  returntrue;

}

The idea performs, in most cases. The idea however involves you finding your current spreadsheet computer software, along with generating your filename as it creates some sort of weird data file name. (Example: 14YuskG_. Csv. Part).

Any suggestions on how to improve this?

Related Questions