Stuck replacing chars
Posted: Thu Dec 03, 2009 2:54 pm
Hi Guys
I'm new to this forum and inexperienced when it comes to macros so please bare with me if I don't explain myself very well.
I have a spreadsheet that is in csv format. I need to convert it to sql format.
The csv has 2 types of row, unpopulated and populated (example below)
My other problem is putting ), on the end of the populated lines. I can exclude the ), from the unpopulated lines in stage 3 above if this makes it easier.
Thank you in advance for any help you can give.
Ray
I'm new to this forum and inexperienced when it comes to macros so please bare with me if I don't explain myself very well.
I have a spreadsheet that is in csv format. I need to convert it to sql format.
The csv has 2 types of row, unpopulated and populated (example below)
I need them to look like this..1,Sunday,00:00:00,,,,
17,Sunday,16:00:00,19:00:00,Sunday Afternon Show,Mark & Aly,Rubbish
However, I can only get part way. I do the following.(1,'Sunday','00:00:00',null,null,null,null),
(17,'Sunday','16:00:00','19:00:00','Sunday Afternon Show','Mark & Aly','Rubbish'),
With this I get the following..1 Add ( to start of each line. Replace ^ with (
2 Add ' around text. Replace , with ','
3 Replace 00','','','',' with 00',null,null,null,null),
From this you will see that I have an unwanted ' after the first number. Without doing each of the 168 line individually I cannot get rid of it.(1','Sunday','00:00:00',null,null,null,null),
(17','Sunday','16:00:00','19:00:00','Sunday Afternon Show','Mark & Aly','Rubbish
My other problem is putting ), on the end of the populated lines. I can exclude the ), from the unpopulated lines in stage 3 above if this makes it easier.
Thank you in advance for any help you can give.
Ray