Conversion of .xls file to .csv file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Conversion of .xls file to .csv file
# 1  
Old 04-15-2009
Error Conversion of .xls file to .csv file

Hi Folks,

I've to convert manually couple of *.xls files to *.csv files everyday Smilie
so i was just wondering if anyone could just help me with a shell script or awk script to automate the process Smilie

PS : Problem is that i cannot use any third party software for the conversion.

Thanking you in advance.
-chaturvedi
# 2  
Old 04-15-2009
if you have to do this everyday, it becomes part of your work. since its part of work, why don't you get permission from your boss about using third party software?
if you have Perl, you can install Spreadsheet::ParseExcel module
Code:
           use strict;
           use Spreadsheet::ParseExcel;
           my @ROW=();
           my $parser   = Spreadsheet::ParseExcel->new();
           my $workbook = $parser->Parse('test.xls');
           for my $worksheet ( $workbook->worksheets() ) {
               my ( $row_min, $row_max ) = $worksheet->row_range();
               my ( $col_min, $col_max ) = $worksheet->col_range();
               for my $row ( $row_min .. $row_max ) {
                   @ROW=();
                   for my $col ( $col_min .. $col_max ) {
                       my $cell = $worksheet->get_cell( $row, $col );
                       next unless $cell;
                       push(@ROW,$cell->value());
                   }
                   print join(",",@ROW)."\n";     
               }               
           }

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generate .csv/ xls file report

There can be thousand of .ksh in a specific directory where sql files are called from ksh. Requirement is to loop through all the files content and generate a report like below: Jobname Type type sqlname gemd1970 sql daily tran01 gemw1971 sql weekly ... (6 Replies)
Discussion started by: vedanta
6 Replies

2. Shell Programming and Scripting

how to parse this file and obtain a .csv or .xls

Hello Expert, I have a file in the following format: SYNTAX_VERSION 5 MONITOR "NAME_TEMPLATES" DESCRIPTION "Monitors for contents of error " INTERVAL "1m" MONPROG "script.sh NAME_TEMPLATES" MAXTHRESHOLD GEN_BELOW_RESET SEVERITY Major ... (17 Replies)
Discussion started by: Ant-one
17 Replies

3. Shell Programming and Scripting

How to convert a xls file to csv?

Hi, My requirement is to convert the xls to csv file with utf-8 conversion. Is there any way please suggest me. Thanks, Raja (4 Replies)
Discussion started by: cnraja
4 Replies

4. UNIX for Advanced & Expert Users

Converting .csv file into .xls file and send it to inbox

Hi All, I wrote a script to extract data from Oracle DB and place it in a text file , and I have coverted .txt file into comma seperated .csv file and I sent it to my mail box . I can get .xls file in my inbox.I am getting all data in same column and in different rows , without column... (1 Reply)
Discussion started by: krthkmuthu
1 Replies

5. AIX

How to convert csv file to xls file

Hi All, I have a java program running in AIX machine which gives me the output in form of .CSV but my clients wants output in the form of .xls When I gave the command mv <filename.csv> <filename.xls> The contents of this .xls file is not exactly in seprate columns as in CSV, the contents... (1 Reply)
Discussion started by: chetu777
1 Replies

6. Shell Programming and Scripting

converting xls file to txt file and xls to csv

I need to convert an excel file into a text file and an excel file into a CSV file.. any code to do that is appreciated thanks (6 Replies)
Discussion started by: bandar007
6 Replies

7. Shell Programming and Scripting

Convert a csv file to an xls format

Hi, I have a file coming in xxx.txt(csv format) i do some work on it and i need to send out as a .xls format. Is there any way there is some code i can use in my script to convert this? I'm struggling on this. Thanks (11 Replies)
Discussion started by: Pablo_beezo
11 Replies

8. Shell Programming and Scripting

.xls to .csv conversion

Hi Please can someone tell me how i can convert .xls file into .csv on both platforms, windows and unix. many thanks, neil (4 Replies)
Discussion started by: neil546
4 Replies

9. Shell Programming and Scripting

From xls to csv file

Can we convert an xls file into csv format in Unix Thanks Suresh (1 Reply)
Discussion started by: sureshg_sampat
1 Replies

10. Shell Programming and Scripting

copying the csv file into different worksheets of xls file

Hi, I have a script which will generate three csv files. i want to copy the contents of these csv files into a .XLS file but in different worksheets. Can a this be done in the same script? :confused: Can Perl come to my help in coping the csv files into different worksheets of .XLS file ?... (0 Replies)
Discussion started by: nimish
0 Replies
Login or Register to Ask a Question