OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

generating a csv file without empty cells - how?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
contactme
General User
General User


Joined: 26 Oct 2007
Posts: 9

PostPosted: Tue Oct 30, 2007 11:56 am    Post subject: generating a csv file without empty cells - how? Reply with quote

Hi,
I have a spreadsheet having different number of columns filled in different rows, and I want to generate a csv file, ignoring those empty cells: for example, if there is no data for the field "address2" in the 2nd row, I am getting the following output:

"Name","Address1","Address2","City"
"A","M street","basement","NY"
"B","X street",,"NY"

The desired output is:

"Name","Address1","Address2","City"
"A","M street","basement","NY"
"B","X street","NY"

Any suggestions will be appreciated.

Moderaor have suggested me to put in here, so if anybody can suggest me any macro which can solve this solution that would be great...Smile
(http://www.oooforum.org/forum/viewtopic.phtml?p=259144#259144)

thanks
Back to top
View user's profile Send private message
PBiela
Power User
Power User


Joined: 10 Feb 2004
Posts: 56
Location: Frankfurt/Main Germany

PostPosted: Wed Oct 31, 2007 3:07 am    Post subject: Reply with quote

Hi there,

i would suggest, you export it as csv and then manipulate the csv-file directly.

There you just have to replace any occurance of ",," or "[,]+" with ",".

That might be easier than copying the data or your spreadsheet into a new sheet without empty cells and generate the csv correctly.

Hope that helped a bit.
_________________
Question Who is John Galt? - Ayn Rand Question
Back to top
View user's profile Send private message
contactme
General User
General User


Joined: 26 Oct 2007
Posts: 9

PostPosted: Wed Oct 31, 2007 11:22 am    Post subject: Reply with quote

yeah, that's always an option but that would mean I would be modifying my parser to handle that scenario as my parser would be parsing the csv files ..

thanks, but can get macro as well that would be great..Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group