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

How can you set a value to a cell - this is the very primitive function; the example given shows input and complicated way to set the value of a cell. #47

Closed
meyers007 opened this issue May 29, 2020 · 2 comments

Comments

@meyers007
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@meyers007
Copy link
Author

How can you set a value to a cell - this is the very primitive function; the example given shows input and complicated way to set the value of a cell.

The following is too messy;

```

xl_model.calculate(
inputs={
"'[EXCEL.XLSX]DATA'!A2": 3, # To overwrite the default value.
"'[EXCEL.XLSX]DATA'!B3": 2 # To impose a value to B3 cell.
},
outputs=[
"'[EXCEL.XLSX]DATA'!C2", "'[EXCEL.XLSX]DATA'!C6"
] # To define the outputs that you want to calculate.
)



How can I just a value of cell something like:
         `xl_model['A1'] = 30 `

@vinci1it2000
Copy link
Owner

vinci1it2000 commented Jun 15, 2020

You have to specify the excel filename and sheet name ("'[<filename>]<sheetname>'!<coord>") as follows:

>>> xl_model.calculate({"'[EXCEL.XLSX]DATA'!A1": 30})

If you want just to set the cell's values without executing the formulas, I suggest using another library like openpyxl.

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

No branches or pull requests

2 participants