Sponsored Content
Top Forums Shell Programming and Scripting Merge *.csv files, each in separate sheets Post 302738029 by Yoda on Friday 30th of November 2012 09:04:37 AM
Old 11-30-2012
You can do this in Perl, search for examples using Spreadsheet::WriteExcel Perl module.
 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

How to create a CSV File by reading fields from separate files

SHELL SCRIPT Hi, I have 3 separate files within a folder. Every File contains data in a single column like File1 contains data mayank sushant dheeraj File2 contains DSA_AT MG_AT FLAT_09 File3 contains data 123123 232323 (2 Replies)
Discussion started by: mayanksargoch
2 Replies

3. Shell Programming and Scripting

Merge 2 csv files with awk

I have 2 files pipe delimted and want to merge them based on a key e.g file 1 123$aaa$yyy$zzz 345$xab$yzy$zyz 456$sss$ttt$foo 799$aaa$ggg$dee file 2 123$hhh 345$ddd 456$xxx 888$zzz so if the key is the first field, and the result should be the common key between file 1 and 2 (6 Replies)
Discussion started by: loloAix
6 Replies

4. Shell Programming and Scripting

Merge 2 CSV files using sed

Help in writing a script using sed which updates fileOne with the contents from fileTwo Example: Contents of fileOne 1,111111 2,897823 3,235473 4,222222 Contents of fileTwo 1,111111,A,1,2 4,222222,A,2,2 5,374632,A,3,2 6,374654,A,4,2 Final File should be: 1,111111,A,1,2... (9 Replies)
Discussion started by: NewToSed
9 Replies

5. Shell Programming and Scripting

create separate files from one excel file with multiple sheets

Hi, I have one requirement, create separate files (".csv") from one excel file(xlsx) with multiple sheets. These ".csv" files are my source files. So anybody please suggest me the process. Thanks in Advance. Regards, Harris (3 Replies)
Discussion started by: harris
3 Replies

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

7. Shell Programming and Scripting

Merge CSV files

I have lot of csv file collected from script like below : Name of files (some examples) there are thousands of it: 192.168.0.123_251_18796_1433144473.csv 192.168.0.123_251_18796_1433144772.csv 192.168.0.123_251_18796_1433145073.csv 192.168.0.123_251_18796_1433145372.csvContent of each... (5 Replies)
Discussion started by: rk4k
5 Replies

8. UNIX for Dummies Questions & Answers

Merge two csv files using column name

Hi all, I have two separate csv files(comma delimited) file 1 and file 2. File 1 contains PAN,NAME,Salary AAAAA5467D,Raj,50000 AAFAC5467D,Ram,60000 BDCFA5677D,Kumar,90000 File 2 contains PAN,NAME,Dept,Salary ASDFG6756T,Karthik,ABC,450000 QWERT8765Y,JAX,CDR,780000... (5 Replies)
Discussion started by: Nivas
5 Replies

9. Programming

Perl script to merge cells in column1 which has same strings, for all sheets in a excel workbook

Perl script to merge cells ---------- Post updated at 12:59 AM ---------- Previous update was at 12:54 AM ---------- I am using below code to read files from a dir and print to excel. open(my $in, '<', $file) or die "Could not open file: $!"; my $rowCount = 0; my $colCount = 0;... (11 Replies)
Discussion started by: Jack_Bruce
11 Replies

10. UNIX for Beginners Questions & Answers

Merge the three csv files as one according to first coloumn.

I have three files with similar pattern i need to merge all the coloumns side by side from all three files according to the first coloumn example as shown below I mentioned 5 coloumns only in example but i have around 15 coloumns in each file. file1: Name,Samples,Error,95RT,90RT... (4 Replies)
Discussion started by: Raghuram717
4 Replies
Spreadsheet::WriteExcel::Formula(3pm)			User Contributed Perl Documentation		     Spreadsheet::WriteExcel::Formula(3pm)

NAME
Formula - A class for generating Excel formulas SYNOPSIS
See the documentation for Spreadsheet::WriteExcel DESCRIPTION
This module is used by Spreadsheet::WriteExcel. You do not need to use it directly. NOTES
The following notes are to help developers and maintainers understand the sequence of operation. They are also intended as a pro-memoria for the author. ;-) Spreadsheet::WriteExcel::Formula converts a textual representation of a formula into the pre-parsed binary format that Excel uses to store formulas. For example "1+2*3" is stored as follows: "1E 01 00 1E 02 00 1E 03 00 05 03". This string is comprised of operators and operands arranged in a reverse-Polish format. The meaning of the tokens in the above example is shown in the following table: Token Name Value 1E ptgInt 0001 (stored as 01 00) 1E ptgInt 0002 (stored as 02 00) 1E ptgInt 0003 (stored as 03 00) 05 ptgMul 03 ptgAdd The tokens and token names are defined in the "Excel Developer's Kit" from Microsoft Press. "ptg" stands for Parse ThinG (as in "That lexer can't grok it, it's a parse thang.") In general the tokens fall into two categories: operators such as "ptgMul" and operands such as "ptgInt". When the formula is evaluated by Excel the operand tokens push values onto a stack. The operator tokens then pop the required number of operands off of the stack, perform an operation and push the resulting value back onto the stack. This methodology is similar to the basic operation of a reverse-Polish (RPN) calculator. Spreadsheet::WriteExcel::Formula parses a formula using a "Parse::RecDescent" parser (at a later stage it may use a "Parse::Yapp" parser or "Parse::FastDescent"). The parser converts the textual representation of a formula into a parse tree. Thus, "1+2*3" is converted into something like the following, "e" stands for expression: e / | 1 + e / | 2 * 3 The function "_reverse_tree()" recurses down through this structure swapping the order of operators followed by operands to produce a reverse-Polish tree. In other words the formula is converted from in-fix notation to post-fix. Following the above example the resulting tree would look like this: e / | 1 e + / | 2 3 * The result of the recursion is a single array of tokens. In our example the simplified form would look like the following: (1, 2, 3, *, +) The actual return value contains some additional information to help in the secondary parsing stage: (_num, 1, _num, 2, _num, 3, ptgMul, ptgAdd, _arg, 1) The additional tokens are: Token Meaning _num The next token is a number _str The next token is a string _ref2d The next token is a 2d cell reference _ref3d The next token is a 3d cell reference _range2d The next token is a 2d range _range3d The next token is a 3d range _func The next token is a function _arg The next token is the number of args for a function _class The next token is a function name _vol The formula contains a voltile function The "_arg" token is generated for all lists but is only used for functions that take a variable number of arguments. The "_class" token indicates the start of the arguments to a function. This allows the post-processor to decide the "class" of the ref and range arguments that the function takes. The class can be reference, value or array. Since function calls can be nested, the class variable is stored on a stack in the @class array. The class of the ref or range is then read as the top element of the stack $class[-1]. When a "_func" is read it pops the class value. Certain Excel functions such as RAND() and NOW() are designated as volatile and must be recalculated by Excel every time that a cell is updated. Any formulas that contain one of these functions has a specially formatted "ptgAttr" tag prepended to it to indicate that it is volatile. A secondary parsing stage is carried out by "parse_tokens()" which converts these tokens into a binary string. For the "1+2*3" example this would give: 1E 01 00 1E 02 00 1E 03 00 05 03 This two-pass method could probably have been reduced to a single pass through the "Parse::RecDescent" parser. However, it was easier to develop and debug this way. The token values and formula values are stored in the %ptg and %functions hashes. These hashes and the parser object $parser are exposed as global data. This breaks the OO encapsulation, but means that they can be shared by several instances of Spreadsheet::WriteExcel called from the same program. Non-English function names can be added to the %functions hash using the "function_locale.pl" program in the "examples" directory of the distro. The supported languages are: German, French, Spanish, Portuguese, Dutch, Finnish, Italian and Swedish. These languages are not added by default because there are conflicts between functions names in different languages. The parser is initialised by "_init_parser()". The initialisation is delayed until the first formula is parsed. This eliminates the overhead of generating the parser in programs that are not processing formulas. (The parser should really be pre-compiled, this is to-do when the grammar stabilises). AUTHOR
John McNamara jmcnamara@cpan.org COPYRIGHT
X MM-MMX, John McNamara. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. perl v5.10.1 2010-02-02 Spreadsheet::WriteExcel::Formula(3pm)
All times are GMT -4. The time now is 01:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy