I don't see anything in the documentation, nor do I see any solutions to my problem when querying Google. The README.md file addresses modifying a worksheet withing an existing
workbook, but nothing about adding a work sheet.
If I use this code:
book_file="#{Date.today.strftime("%Y%m")}_engie.xls"
book = Spreadsheet.open book_file
sheet1 = book.create_worksheet(:name => "flash_20171207")
I then loop through the csv file and add the data to sheet1.
I then save the the workbook to a file (not the same file name as book_file).
When I open the new file in Excel I get the can't read data warning and I repair the book but the new worksheet isn't in it. The repair deletes the data.
I I use this code:
book_file="#{Date.today.strftime("%Y%m")}_engie.xls"
book = Spreadsheet.open book_file
sheet1 = book.create_worksheet(:name => "flash_20171207")
book.add_worksheet(sheet1)
Excel will open the file, ask to repair it and after the repair, the new worksheet is available and displays correctly.
I would like to be able to add the new file without Excel asking to repair it. But I haven't quite figured out how.
Has anyone done this