no nick,s. your code is very wrong:
1. var is named wrong
2. gsub wants in this form 2 Strings not one Regex
3. it does not work because there is no "\\" inside path
ya
what work is
path.gsub("\\","\\\\")
but this also not work BECAUSE your main string path has no "\\" inside
so gsub does not replace something and you can not replace the \ inside
path = "C:\Gaurang\ruby\demo.xls"
because its interpreted as \G \r and \d
if you does not want to write
path = "C:\\Gaurang\\ruby\\demo.xls"
you chould write inside ' ' (the char above #)
path = 'C:\Gaurang\ruby\demo.xls'
you can do nothing with "C:\Gaurang\ruby\demo.xls"
no nick,s. your code is very wrong:
1. var is named wrong
2. gsub wants in this form 2 Strings not one Regex
3. it does not work because there is no "\\" inside path
I have used "\\" instead of "\" coz "\" is a escape character.