Instead of hard coding as " categories => '='."$worksheet".'!$B$1:$E$1' ", Can we make it dynamic to select the range of cells to plot the chart?
Any idea how to make it dynamic?
Have a look at Re^3: Win32::Ole excel external data range, in which I show the use of dynamic ranges. It does other things too (it's answering a different question), but I think it's reasonably clear.