Page 1 of 1

Reading and writing data into csv files?

Posted: Wed Sep 06, 2017 12:43 am
by vgupta88
Hi All,

I have a requirement where I need to read data from csv file (e.g. file_one.csv), apply some transformations on the data and then load that data into a new csv file (e.g. file_two.csv).
I tried using Unstructured Data stage as my Target but it shows me an error that "it doesn't support input links". Is it possible to achieve above requirement using Unstructured Data stage (version 9.1)?

Appreciate anyones help on the above query.

Thanks!

Posted: Wed Sep 06, 2017 6:01 am
by chulett
There's nothing "unstructured" about your data so why use that stage? Use the normal Sequential File stage.

Posted: Wed Sep 06, 2017 8:08 am
by UCDI
csv files are simple text files that happen to have commas between data blobs that represent 'columns'. Nothing more.

You can process them just fine with a flat file & transformer stage.

Posted: Wed Sep 06, 2017 11:21 pm
by vgupta88
Craig,

I have multiple tabs in the csv file which needs to be processed which I suppose makes it "Unstructured"

Thanks!

Posted: Thu Sep 07, 2017 3:49 am
by ray.wurlod
There are no tabs in a CSV file. It is a regular text file. Can you please be more specific?

Posted: Thu Sep 07, 2017 4:15 am
by vgupta88
My bad.. So to clear out confusion and to explain better - I have excel spreadsheets which are saved as .csv file format. ;-) These spreadsheets have multiple client specific tabs in it.
So now, I want to process these spreadsheets data, transform them and create a new excel spreadsheet with similar client specific details in separate tabs.

Posted: Thu Sep 07, 2017 6:24 am
by anudeepdasari001
Its not supported Writing to the spreadsheets using the unstructured Data Stage in 9.1 version, You can always do that in 11.5 version, Where you have ability to write to a single or all the sheets in a workbook.

Posted: Thu Sep 07, 2017 7:32 am
by vgupta88
So, any other method to achieve this?
The basic thing that I am looking after is generating new excel spreadsheet. I can manage with basic one single tab also.

Any help would be much appreciated!

Thanks!

Posted: Thu Sep 07, 2017 7:45 am
by chulett
Without access to the latest version, the typical answer for a "basic one single tab" would be simply another csv file. Excel will automatically open them as a spreadsheet, it would be up to the user to save it back as an xls.

You may be able to leverage ODBC for this, there are UNIX drivers specifically for Excel from what I recall. You would have to purchase them, however.

Posted: Mon Sep 11, 2017 12:24 am
by vgupta88
Thanks Craig!
Just one more concern, does metadata in different tabs present in excel sheet needs to same in Unstructured Data Stage?

Thanks in advance.

Posted: Mon Sep 11, 2017 6:43 am
by chulett
Not that I am aware of, each is treated as a separate 'table' in essence from what I recall.

Posted: Mon Sep 11, 2017 8:18 am
by vgupta88
It seems like the metadata needs to be same. Otherwise it throws an error - Different number of columns in the sheets <sheet_name>.

Posted: Mon Sep 11, 2017 8:33 am
by chulett
That seems oddly... restrictive... to me. :?

Let's see what others have to say.

Posted: Thu Sep 14, 2017 7:10 am
by vgupta88
No inputs from anyone?

Thanks!

Posted: Thu Sep 14, 2017 7:39 am
by chulett
Open a support case.