Reputation: 149
from pycel import ExcelCompiler
file = 'test.xlsx'
excel_compiler = ExcelCompiler(file)
excel_compiler.to_file(file + ".yaml")
cycles: false
excel_hash: 50c4cf43c7d0ba6fe6ee608b6deebab2
cell_map: {}
filename: test.xlsx
Problem is: test.xlsx has A: 13
, B: 23
and C: =A+B
Why is cell_map
empty?
Upvotes: 1
Views: 368
Reputation: 49774
Pycel does not output an entire spreadsheet. It outputs the "interesting" parts of a spreadsheet.
Pycel builds a graph of the cells involved in computations. The graph is built during the process of "compiling" a cell. If the formula for a cell contains references to other cells, those cells are also added to the graph. This process is recursive, and it needs to be seeded with cells of interest, to know which cells to compile.
In the example code, there are at two ways shown to "populate" the calculation graph in pycel.
excel.evaluate('Sheet1!D1')
trim_graph()
# As an alternative to using evaluate to put cells in the graph and
# as a way to trim down the size of the file to just that needed.
excel.trim_graph(input_addrs=['Sheet1!A1'], output_addrs=['Sheet1!D1'])
Dislaimer: I am the maintainer of Pycel
Upvotes: 2