[CALUG] Reading CSV using Python / PHP

Rajiv Gunja opn.src.rocks at gmail.com
Mon May 16 11:53:02 EDT 2016


All,
awk worked, but had an issue with multi-lined columns. Python script got
too complicated.

Finally, used Excel Macros to filter the spreadsheet, create TABs and
beautify the CSV. This brought down my repetitive work from 4 hours to 2
minutes.
Created multiple macros so I can selectively run the macros.

Thank you all.


-GG

On Thu, Apr 28, 2016 at 7:06 PM, Berend Tober <btober at computer.org> wrote:

> Rajiv Gunja wrote:
>
>> Hey all, I am trying to cut down on the amount of manual steps I have to
>> take editing CSV file - sorting, creating new tabs and categorising them.
>> I googled and found logparser from MS, could not figure it out - maybe a
>> mental block towards anything MS.
>>
>> I saw that it was possible using python or PHP. So turning to you guys
>> for advice. Which one works best or is there a different way?
>>
>> I do not know Python, but I can learn. PHP, I am very familiar with, but
>> whichever is efficient and can do a better job, I will use it.
>>
>> Problem:
>> 1. CSV file has 2000+ rows
>> 2. Some columns are multi-line with \r and \n
>> 3. fields are separated by "," and each data item is between quotes (" ")
>>
>>
> Your problem #2 is really a problem, but barring that, I have had great
> success with CSVKIT, which happens to be a Python implementation, but you
> don't have to know that in order to use the utilities.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unknownlamer.org/pipermail/calug/attachments/20160516/28cd8189/attachment.html>


More information about the CALUG mailing list