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

save updated cell values as an excel file #238

Open
NSanjay opened this issue Sep 4, 2019 · 2 comments
Open

save updated cell values as an excel file #238

NSanjay opened this issue Sep 4, 2019 · 2 comments

Comments

@NSanjay
Copy link

NSanjay commented Sep 4, 2019

Hi

Apologies if this has been answered somewhere, but I went through the docs and couldn't find anything related to saving changes I make to a spreadsheet to a new .xlsx file. I understand that only the reading part has been borrowed from openpyxl. But does koala allow me to do write changes to a new excel spreadsheet? If so, I wanted to know how

Here's the code I've tried so far:

from koala.Spreadsheet import Spreadsheet

filename = "test.xlsx"
sp = Spreadsheet(filename)

# check current values
print(sp.cell_evaluate('Sheet1!BV25'))
print(sp.cell_evaluate('Sheet1!BV65'))

#change to new value
sp.cell_set_value('Sheet1!BV25', 0.05)

#check if values have updated
print(sp.cell_evaluate('Sheet1!BV25'))
print(sp.cell_evaluate('Sheet1!BV65'))

#sp.gen_graph()

#sp.prune_graph()

#sp.dump(filename.replace(".xlsx","_modified.xlsx"))

The cell BV65 is dependent on BV25. After I change the value of BV25, I see the value of BV65 has updated, but I want to save these changes as a .xlsx file, without involving Microsoft Excel during the update process.

I tried the last 3 commented lines, but MS Excel could not open the generated file.

Thanks in advance,
Sanjay

@SlavaKozlov
Copy link

I was looking for the same thing: save to an Excel file. I don't see this as supported in the code (v 0.0.36).

The generated gzip file from a dump has nothing to do with an Excel format. It is just the cell graph.

I agree it would be super useful to be able to save the changed graph back into Excel. Without this feature, it is almost impossible to troubleshoot issues in the original Excel code (treating the Excel file as a function). It wouldn't need to be too exciting - the formatting is stripped - but it would be a valuable feature.

Thanks

@charlesdwright
Copy link

Yeah, me too.

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

3 participants