Error while Converting Excel to CSV using xls2csv


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error while Converting Excel to CSV using xls2csv
# 1  
Old 11-17-2013
Error while Converting Excel to CSV using xls2csv

I am using xls2csv to convert a xls file into a regular .csv file. However, while using the command as
Code:
xls2csv fromfile.xls > tofile.csv

I am getting the following error.
Code:
fromfile.xls is not OLE file or Error

I also tried to specify the comma as delimiter but did not help...
Code:
xls2csv -c\, fromfile.xls > tofile.csv

Do not know what is it that I am doing wrong.
# 2  
Old 11-17-2013
Try running against simple testing .xls documents saved form Excel, with both "Excel 97-2003 Workbook" and "Microsoft Excel 5.0/95 Workbook" formats.

There are a few different versions of xls2csv around, including a CPAN perl module. Please paste any output you get from xls2csv -V here so we know what we are dealing with.
# 3  
Old 11-17-2013
@Chubler_XL: The xls2csv version is "Catdoc Version 0.94.2". I will check against simple .xls and let you know tomorrow as I do not have access at home...
# 4  
Old 11-17-2013
hi,

more probably, your .xls file is not an xls file.
what does answer ``file yourFile.xls'' ?

I've already downloaded files as .xls which were in fact html ones.
# 5  
Old 11-17-2013
I've done some quick tests here with that version and both "Excel 97-2003 Workbook" and "Microsoft Excel 5.0/95 Workbook" formats convert fine.

However if I save as "XML workbook format", which has a default extension of xml by the way. I also get the same error:

Code:
$ ls ss*
ss_95.xls  ss_97.xls  ss.xml

$ file ss*
ss_95.xls: Composite Document File V2 Document, Little Endian, Os: Windows, Version 6.1, Code page: 1252, Author: Chubler_XL, Last Saved By: Chubler_XL, Name of Creating Application: Microsoft Excel, Create Time/Date: Mon Nov 18 02:31:35 2013, Last Saved Time/Date: Mon Nov 18 02:32:49 2013, Security: 0
ss_97.xls: Composite Document File V2 Document, Little Endian, Os: Windows, Version 6.1, Code page: 1252, Author: Chubler_XL, Last Saved By: Chubler_XL, Name of Creating Application: Microsoft Excel, Create Time/Date: Mon Nov 18 02:31:35 2013, Last Saved Time/Date: Mon Nov 18 02:32:33 2013, Security: 0
ss.xml:    XML document text

$ xls2csv ss_95.xls 
"Name","age","ss"
"Tim","16","10"
"Mike","45","11"
"Steve","28","12"

$ xls2csv ss.xml
ss.xml is not OLE file or Error

So it looks like the OLE error indicates an unsupported XLS format or a corrupted file.
# 6  
Old 11-19-2013
@dePeach/@Chubler_XL: Sorry for the late reply,

Code:
file fromfile.xls

gives me

Code:
fromfile.xls: data

So, I assume this file that I am working on is not really a .xls file. How do I work in converting this file into .CSV file? Appreciate your help.

Last edited by dhruuv369; 11-19-2013 at 02:49 PM.. Reason: No Specific reason
# 7  
Old 11-19-2013
This first stage is going to be finding out what format the file is in. Transfer the file to a windows box and try opening it with Excel.

If Excel can open it try SaveAs, using "Excel 97-2003 Workbook" or "Microsoft Excel 5.0/95 Workbook" format and test the newly saved file with xls2csv. If this works then we have proven that the format of the original .xls, although recognisable by Excel, is not supported by xls2csv.

If Excel won't open it you have little options -> the file is corrupted, rebuild/resave a proper .xls file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting XML to CSV

Hello, For i while i have been using XMLStarlet to convert several XML files to CSV files. So far this always went fine. Today however i got a new XML format however but i cannot find out how to get the data i need. Below is part of the code where it shows the different format. What... (10 Replies)
Discussion started by: SDohmen
10 Replies

2. UNIX for Dummies Questions & Answers

Convert csv to excel

Hi All, I have a csv file in unix and I need to convert it into excel formate. Please help me out (1 Reply)
Discussion started by: Abhisrajput
1 Replies

3. Shell Programming and Scripting

Shell Script for converting file to Excel or CSV

Hi I have a dat file which has "n" number of columns. The file is delimited. The number of columns keep varying as the file is generated out of DB queries. Could you please help me in writing a script which will generate a XLS or CSV file out of the dat file. (5 Replies)
Discussion started by: Vee
5 Replies

4. Programming

converting data from excel sheet to oracle using toad

guys i have data in excel sheet , how do i convert that data to database table (2 Replies)
Discussion started by: Gl@)!aTor
2 Replies

5. Shell Programming and Scripting

Converting specific Excel file tabs to CSV in Python

Hi list, This is probably something really simple, but I am not particularly familiar with Python so I thought I would ask as I know that python has an excel module. I have an excel document with multiple tabs of data and graphs. One of the tabs is just data which I require to have dumped to... (8 Replies)
Discussion started by: landossa
8 Replies

6. Shell Programming and Scripting

Converting excel to '|' delimiter

Hi All, Can you please suggest me how to convert excel format to ‘|' delimiter file. I need to use perl script Thanks Rama (5 Replies)
Discussion started by: murari83.ds
5 Replies

7. Shell Programming and Scripting

KSH - Text from input file truncated while converting it to excel

Dear Members, I am using the attached script to convert a input file delimited by '|' to excel. However, while processing the attribute change_reason, the whole content of the text under change_reason is not displayed completely in the cell in excel. It is truncated after only first few words.... (1 Reply)
Discussion started by: Yoodit
1 Replies

8. UNIX for Dummies Questions & Answers

Excel File to CSV

Hi All, I have to convert the excel file which will be placed in the Unix box to a CSV file using a shell script. Please Advise. Thanks & Regards, Kumar66 (1 Reply)
Discussion started by: kumar66
1 Replies

9. UNIX for Advanced & Expert Users

Problem in converting password protected excel file to csv file in unix

I need to convert a password protected excel file which will be in UNIX server to a comma separated file. For this I need to open the excel file in UNIX box but the UNIX box doesn't prompt for password instead it is opened in an encrypted manner. I could manually ftp the excel file to local... (2 Replies)
Discussion started by: Devivish
2 Replies

10. Shell Programming and Scripting

Converting excel to text

Is it possible to convert an excel file into a text file using standard HP UNIX commands? Possibly in K Shell? (5 Replies)
Discussion started by: stevefox
5 Replies
Login or Register to Ask a Question