I want to convert a file containing certain records to an excel sheet. The records contain special characters like comma, /, , “”, *, &, %,$,etc. How should I proceed ?

If you want to create something with multiple sheets, you should explore perl or java. Otherwise, you would be creating text files.

CSV is the simplest text input to Excel. It can handle any character, as the rules are:

  1. Double quotes in input are doubled to escape them.
  2. Commas and line breaks in cells require that they be double-quoted.
    3, cells are comma separated, and lines/rows are nominally cr+lf separated, but usually either works.
    Early versions of MS Access did not handle the quoting properly.

Tab separated text is another way, but Excel handles it like CSV but with tabs not commas.

If you name a CSV file *.xls, it encourages the recipient to save it as a real spreadsheet (they do not lose any formatting they add).

If you want real Excel xls or xlsx, there are PERL libs and tools that can write that directly or convert text.

Actually, an Excel .xlsx file is all XML text. The .xlsx file is a .zip with the extension changed, and it unpacks into a hierarchy of text files containing mark-up.

All the worksheets are just numbers, with the mark-up designating other files and indexes into them. For example, all text is in a SharedText file, and the markup is like

@Marty

LOL…totally right, marty!

sepehr’s comment is on the mark. “certain records” is pretty indefinite. Is there any way to delimit the fields?

It’s a fair guess that on average, half the posts here are to educate the questioner on how to ask, what to supply?

I think the simplest way is to use CSV (Comma Separated Value) format. The idea is to reformat your output.Then you import your CSV file into excel, choose ‘CSV’, then ‘formatted’ and make sure values are separated by a comma.

Cheers,
Sepehr

Hi,

excel file has a lot of binary data(meta data)

and there is no simple way to write a shell script

check content of an excel file by “od”(octal dump) command

Hi

Please provide your sample text file here.

Sepehr