无论如何,有没有用openpyxl用公式刷新所有单元格?

时间:2019-02-03 16:28:10

标签: python excel vba openpyxl

我有一个问题,openpyxl不能计算公式单元格,除非我用“ F2”将其选中然后输入。 例如, 我有这个代码

ws.cell(row=1,column=1,value="=VLOOKUP(CF{0},VlookupSheet!$A:$H,8,FALSE)".format(2))

我希望通过vlookup公式从Vlookupsheet中看到一个值。 但是,它显示为空单元格,但我手动刷新它。

此外。我有一本字典,该字典读取此单元格作为将值写入单元格的键。由于此vlookup无法创建一个字典,因此我的字典无法正常工作。

您有什么建议吗?

1 个答案:

答案 0 :(得分:0)

尝试运行// test.page.spec.ts import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { TestPage } from './test.page'; describe('TestPage', () => { let component: TestPage; let fixture: ComponentFixture<TestPage>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ TestPage ], schemas: [CUSTOM_ELEMENTS_SCHEMA], }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(TestPage); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should have a searchbar', () => { const el: HTMLElement = fixture.nativeElement; const bar = el.querySelector('ion-searchbar'); fixture.detectChanges(); expect(bar).not.toBeNull(); // PASSES // adding some checks to see what is going on expect(bar.children.length).toBeGreaterThan(0); // FAILS expect(bar.innerHTML).not.toEqual(''); // FAILS expect(bar.shadowRoot).not.toBeNull(); // FAILS }); it('should have an input field', () => { const el: HTMLElement = fixture.nativeElement; const input = el.querySelector('input'); expect(input).not.toBeNull(); // FAILS }); }); 。它将刷新所有单元格。

Application.CalculateFull method (Excel)