Sponsored Content
Top Forums Shell Programming and Scripting Tabbed multiple csv files into one single excel file with using shell script not perl Post 303013327 by Chubler_XL on Monday 19th of February 2018 04:13:52 PM
Old 02-19-2018
Sorry ramakrk2 but these Forums are about assisting you to help yourself not providing ready made scripts. It sounds like you have some shell scripting skills and a multi tab excel sheet is really just a text file in the correct format.

To assist you further here is a worked example for a simple case of two csv files:

File 1:
Code:
12.5,cell 2

File 2:
Code:
file 2 row 1,11.9,Testing
file 2 row 2,23.7,Unix
file 2 row 3,99.9,Scripting


Target output (XML workbook):
Code:
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
  </Style>
 </Styles>

 <Worksheet ss:Name="Sheet 1">
  <Table>
<Row>
    <Cell><Data ss:Type="Number">12.5</Data></Cell>
    <Cell><Data ss:Type="String">cell 2</Data></Cell>
</Row>
  </Table>
 </Worksheet>

 <Worksheet ss:Name="Sheet 2">
  <Table>
<Row>
    <Cell><Data ss:Type="String">file 2 row 1</Data></Cell>
    <Cell><Data ss:Type="Number">11.9</Data></Cell>
    <Cell><Data ss:Type="String">Testing</Data></Cell>
</Row>

<Row>
    <Cell><Data ss:Type="String">file 2 row 2</Data></Cell>
    <Cell><Data ss:Type="Number">23.7</Data></Cell>
    <Cell><Data ss:Type="String">Unix</Data></Cell>
</Row>

<Row>
    <Cell><Data ss:Type="String">file 2 row 3</Data></Cell>
    <Cell><Data ss:Type="Number">99.9</Data></Cell>
    <Cell><Data ss:Type="String">Scripting</Data></Cell>
</Row>
  </Table>
 </Worksheet>

</Workbook>

Don't let this big block of text throw you off.

Most of it is produced by outputting fixed text strings, with only the red blocks needing to be populated from your data (csv files).

Last edited by Chubler_XL; 02-19-2018 at 05:22 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing Multiple .SQL Files from Single Shell Script file

Hi, Please help me out. I have around 700 sql files to execute in a defined order, how can i do it from shell script (3 Replies)
Discussion started by: anushilrai
3 Replies

2. Shell Programming and Scripting

Add multiple .csv files as sheets to an excel file in unix.

Hi, I am using Solaris 8. My script outputs 4 .csv files. Currently I am SFTPing the files and creating a new excel file with the 4 files as sheets. Can anyone suggest ways to do this in UNIX ? Thanks, David. (2 Replies)
Discussion started by: libin4u2000
2 Replies

3. Shell Programming and Scripting

Shell script - Excel/CSV file - More than one tab

Hi All, Following is my requirement. I have searched the site and found some threads which has same queries, but non of them have any answer. I thought of posting it once more. We are generating different reports through shell script after we finish our data load. Currently there are 7 such... (5 Replies)
Discussion started by: ace_friends22
5 Replies

4. Shell Programming and Scripting

Copy Data from CSV file to Excel Sheet using Perl

Hi All, Firstly I will like to wish A Happy New Year to all. Now my issue is I have one csv file say(data.csv) and one excel file say(result.xls) The result.xls contains two sheet name Sheet1 and Sheet2, Now What I am trying to do is to First I want to delete that data of Sheet2 if present any,... (6 Replies)
Discussion started by: adisky123
6 Replies

5. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

6. 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

7. UNIX for Dummies Questions & Answers

How to Create excel file(.csv) using shell script?

Hi, i have shell script which compiles n number of test cases and execute them one by one. i want to create report in excel through script in which two columns namely "test id" and "release".second column have two subcolumns namely compiles and excutes. so i want first column should display test... (15 Replies)
Discussion started by: RamMore123
15 Replies

8. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

9. Shell Programming and Scripting

Write two csv files into one excel with multiple sheets

I have requirement to write two CSV files to one single excel with multiple sheets. Data present in the two files should sit in excel as different sheets. How can we achieve this using shell script? 1.csv 2. csv 1,2,3,4 5,6,7,8 XXXXX YYYYY Res.excel 1.csv data... (1 Reply)
Discussion started by: duplicate
1 Replies

10. Shell Programming and Scripting

awk - CSV file - field with single or multiple spaces

Hi, In a csv file, I want to select records where first column has zero or multiple spaces. Eg: abc.csv ,123,a ,22,b ,11,c a,11,d So output should be: ,123,a ,22,b ,11,c Please advise (5 Replies)
Discussion started by: vegasluxor
5 Replies
All times are GMT -4. The time now is 01:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy