How to recover data from disconnected ppt charts
For those who handle lots of powerpoint files at work, few things are more annoying than ppt charts that have lost links with their original data set. Luckily you can still figure out the original data by hovering over the points, but what would you do with a chart that has hundreds, if not thousands of data points?
A few days ago I was in that situation where I had a disconnected grouped bar chart. It had 4 series times 7 categories, so 28 data points. This was enough to irritate me, and I found this link.
This guy’s blog explains the solution well, but I thought I could do something with R. So here’s what I’ve come up with. If you have R installed in your mac, you can easily do it.
1. let’s get the ingredients ready.
Here I have a ppt file with 4 different types of charts; a line chart, a pie chart, a bar chart and a group bar chart.
2. save the ppt file, and change it file type from pptx to zip.
It sounds pretty weird, but your computer will allow that to happen.
3. unzip the newly modified zip file.
In the folder, you’ll see a bunch of folders and files.. and among them, you’ll find [charts] folder inside [ppt] folder. That’s where our charts are. 4 xml files there!
4. put them in a folder with ppt_chart_recovery_f.R (again, you can download it from here). Make sure you have no other xml files in the folder, as my R script is designed to parse all the xml files it can find in its folder. Like this.
5. open terminal and go to the test folder. as my [test] folder is in the [desktop] folder, I just need to type “cd desktop/test"
6. run the r code to get the result. type “r” to activate r, and type “source(“ppt_chart_recovery_f.R”). Within a few seconds, the job is done.
It shows some messages that go “Namespace prefix c…” but you can ignore it.
7. check out the results.
Voila! four new csv files! click and hit space to check out what they look like.