I'm using perl script to generate a csv file. When I opened the csv file with Microsoft Excel, right click on any column, click on Format Cells, on Number tab, the Category has 'General' selected.
I wonder if there's any way to format all cells in 'Text' format when I generate this csv from my perl script.
I know perl has a module Text::CSV_PP can format the column type (for e.g. integer column, two double columns and a string column can be set like below)
$csv->types([Text::CSV_PP::IV(),
Text::CSV_PP::NV(),
Text::CSV_PP::NV(),
Text::CSV_PP:
V()]);
but, I don't want to use this module and looking for any simpler way to do it.
Anyone has idea... pls guide me... thanks in advance!
I wonder if there's any way to format all cells in 'Text' format when I generate this csv from my perl script.
I know perl has a module Text::CSV_PP can format the column type (for e.g. integer column, two double columns and a string column can be set like below)
$csv->types([Text::CSV_PP::IV(),
Text::CSV_PP::NV(),
Text::CSV_PP::NV(),
Text::CSV_PP:
but, I don't want to use this module and looking for any simpler way to do it.
Anyone has idea... pls guide me... thanks in advance!
Code:
$csv = "col1,col2,col3\n";
$csv .= "aaa,bbb,ccc\n";
print "Content-Type: text/plain\nContent-Disposition: attachment; filename=\"$filename.csv\"\n\n";
print $csv;