How to delete a file in ruby which is still being used? -


i using spreadsheet gem generate excel file. problem when modify existing file wont allow save same name http://spreadsheet.rubyforge.org/guide_txt.html , in running script cant delete , recreate file beacause still being used. doing throws permission denied error.

any suggeestion overcome this?

follow example provided in documentation linked. use scheme creating 'output' version of document, wrap replacing original 'output' version.

book = spreadsheet.open '/path/to/an/excel-file.xls' sheet = book.worksheet 0 sheet.each |row|   row[0] *= 2 end book.write '/path/to/output/excel-file.xls' 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -