Text to xlsx conversion


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Text to xlsx conversion
# 1  
Old 12-27-2010
Text to xlsx conversion

Hi Guys,
The code snippet below is working fine with xls 2003 but the same is not working in xlsx 2007. Can someone please help.

Code:
#Convert .txt file format to .xls format
awk 'BEGIN{
  FS="|"
cols=8
print "<HTML><style type=\"text/css\">td{mso-number-format:\"\@\"}</style><BODY><TABLE border="1">"
}
NF==cols{
  if(NR>1)
    print "</TD></TR>"
  printf "<TR>"
  for(i=1;i<NF;i++)
    printf "<TD>%s</TD>", $i
  printf "<TD>%s", $NF
}
NF==1{
  printf "\n%s", $0
}

END{
  print "</TD></TR>\n</TABLE></BODY></HTML>"
}
'file.txt > file.xlsx

# 2  
Old 12-29-2010
Can't you leave it as .xls and open the .xls version using Excel 2007?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Python soap and string to .xlsx conversion

Hi experts - I'm relatively new to python, but I have an requirement to automate getting a file from a WebLib server using an API. The file I'm requesting from this sever is an excel spreadsheet (.xlsx). I get a valid response back via an xml doc from the server. In this xml file I get... (8 Replies)
Discussion started by: timj123
8 Replies

2. Programming

Read .xlsx and text files in a loop using openpyxl

I have a list of .xlsx files (names 1.xlsx, 2.xlsx etc) in a directory, on which I need to insert data from its corresponding text file (named 1.txt, 2.txt etc) on the second worksheet named 'Filtered' and save it. The code I am trying is #!/usr/bin/python import os from... (8 Replies)
Discussion started by: nans
8 Replies

3. Shell Programming and Scripting

Text Conversion in Column

Hi all; We have a table: COL1 COL2 COL3 COL4 COL5 COL6 COL7 val1 val2 val3 val4 val5 1 val7 val1 val2 val3 val4 val5 3 val7 val1 val2 val3 val4 val5 5 val7 val1 val2 val3 val4 val5 2 val7 ... As you see, 6th columns are filled with numbers as, 1, 2, 3, 4, etc... and I want to make a... (10 Replies)
Discussion started by: gc_sw
10 Replies

4. Shell Programming and Scripting

HTML Conversion of text file

Hi, I have following text file. I want to convert it into the below HTML format. Kindly help. Input Text File Header 1 ======= Name:*** Age:*** Address:*** Work Phone:*** Email:*** Mobile:*** Country:*** City:*** Pincode:*** some text here **** (10 Replies)
Discussion started by: ctrld
10 Replies

5. Shell Programming and Scripting

Conversion of a text file to html

hi i hav a file called focus. which is the output file. i want to convert this file to html file and mail it. help with code and explanatio. i am basic in unix (7 Replies)
Discussion started by: wasim999
7 Replies

6. UNIX for Advanced & Expert Users

PDF to Text Conversion

Hi Guys, My OS is Suse Linux.. Is there a Command to convert PDF file to Text?? Cheers!!!!! (2 Replies)
Discussion started by: mac4rfree
2 Replies

7. Shell Programming and Scripting

text to csv conversion

Thank u every body ......just need a help so that a text file needs to be converted into CSV............. my log file is as follows Host scsi3: usb-storage Vendor: Maxtor Product: OneTouch III Serial Number: 044303E5 Protocol: Transparent SCSI Transport: Bulk ... (4 Replies)
Discussion started by: tangotango
4 Replies

8. Shell Programming and Scripting

Text to XML conversion using script

Hi I have a file in the format with so many records DB2 Universal JDBC Driver Provider,wdialdcsq,New JDBC Datasource,jdbc/wdialdcsq,,dcsqdb2n,cldrdgw1.is.chrysler.com,2998,DB2,10,1,180,0,1800 i need to convert all these into <DataSource name="wdialODDC" maxConnection="10" minConnection="0 "... (1 Reply)
Discussion started by: mskalyani9
1 Replies

9. Programming

Binary to text format conversion

Hi, Please can any one tell me how to convert binary data to text format and vice versa. If possible give me the algorithm or C program. Thanks in advance Waiting for reply Bye:o (5 Replies)
Discussion started by: manjunath
5 Replies

10. UNIX for Dummies Questions & Answers

ISAM FILE CONVERSION TO TEXT

I am having a problem. There is one ISAM file available in SCO UNIX environment. I want to convert it to simple comma delimited text file. Actual problem is with the size of the file. For the time being, size is 1.3 GB and I have to grab the subset of the data after every five minutes e.g. in... (3 Replies)
Discussion started by: a.waqar
3 Replies
Login or Register to Ask a Question