Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing existing excel #256

Open
facuhump2409 opened this issue Dec 28, 2020 · 8 comments
Open

Editing existing excel #256

facuhump2409 opened this issue Dec 28, 2020 · 8 comments

Comments

@facuhump2409
Copy link

Hi,
I've been having trouble trying to modify an excel file. What I want to do is after processing the data from the excel, change the value from the row. Here's my code:
book = Spreadsheet.open "26-12 orders.xls"
messages = book.worksheet "Whatsapp Messages"
messages.each do |message|
#All the logic
message[0] = "Already processed row"

But when I open again the excel file, no modifications have been made (the "Already processed row" isn't in the file). How can a modify a row from an existing file and save it in the original excel? Is there a way to do it?

@zdavatz
Copy link
Owner

zdavatz commented Dec 29, 2020

how was the Excel file created? Which software created the original XLS file that you are trying to edit?

@facuhump2409
Copy link
Author

It was created in Microsoft excel and then I had to change the extension from .xlsx to .xls in free office

@zdavatz
Copy link
Owner

zdavatz commented Dec 29, 2020

So the original file was XLSX? XLSX is XML, where XLS is a binary format. We only support XLS. You should also try the LibreOffice commandline tools.

@facuhump2409
Copy link
Author

Yes, that’s why I changed its format to .xls but still I don’t see any changes in the file when trying to update a row. Is there something I’m doing wrong?

@facuhump2409
Copy link
Author

Yes, but I’m not trying to add a row but to update a row

@zdavatz
Copy link
Owner

zdavatz commented Dec 29, 2020

are you using the file that you saved with LibreOffice to update the row via Ruby Spreadsheet Gem?

@facuhump2409
Copy link
Author

Yes

@zdavatz
Copy link
Owner

zdavatz commented Dec 29, 2020

ok, the make a simple test script to see if that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants