Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Removing file using Spreadsheet in windows( Errno::EACCESS(Permission denied))

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 511
    Comment on it

    There is no close method in spreadsheet.If you opened the spreadsheet and after reading you need to delete it then FIleUtils.rm(file_name) will work smoothly in linux but in windows it will give permission error

    Errno::EACCESS(Permission denied)

    Initially I have this code

    @book = Spreadsheet.open file_name

    @salary_sheet = @book.worksheet 0

    Above works fine in linux but in Windows it is giving me Permission error so I tried below code.

    Spreadsheet.open file_name do |sheet|

    @salary_sheet = sheet.worksheet 0

    end

    The above code fixed my problem.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: