Macro to convert data

unwantedoz

New Member
Joined
Oct 16, 2015
Messages
2
Hello, I need help making a macro. I spent an hour or two couple of hours googling how to make macros but I still have no idea how to do what I want to.

Anyway I want display a chart on a website. I will be using fusioncharts.js to make it as trying it I have found it really easy to use.

My problem is the data is not in the format it needs. It needs it in either JSON or XML as a single string format.

So the data I record is a csv which looks like this in excel:

Date Cost $
23/08/2015 78
24/08/2015 58
25/08/2015 112
26/08/2015 97

So I need a macro that will convert that simple 2 column data into either of the following:

JSON in the form:

{
"label": "23/08/2015",
"value": "78"
},
{
"label": "24/08/2015",
"value": "59"
},
{
"label": "25/08/2015",
"value": "112"
},
{
"label": "26/08/2015",
"value": "97"
}

or single string XML in the form:

<set label='23/08/2015' value='78' /><set label='24/08/2015' value='59' /><set label='25/08/2015' value='112' /><set label='26/08/2015' value='97' />

Any help would be appreciated.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You say your data is two column but you have pasted a one column piece of data. Which is it?
 
Upvote 0

Forum statistics

Threads
1,215,049
Messages
6,122,864
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top