fix: document merger
This commit is contained in:
@@ -279,9 +279,9 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
sp.set('actions', lambda: flow.capabilities())
|
sp.set('actions', lambda: flow.capabilities())
|
||||||
|
|
||||||
def ready(name: str, b64: str):
|
def ready(name: str, b64: str):
|
||||||
|
nonlocal status, filename, wb, limit
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
from openpyxl import load_workbook
|
from openpyxl import load_workbook
|
||||||
nonlocal status, filename, wb, limit
|
|
||||||
if status != Status.IDLE: raise ValueError(status)
|
if status != Status.IDLE: raise ValueError(status)
|
||||||
|
|
||||||
data = b64decode(b64)
|
data = b64decode(b64)
|
||||||
@@ -307,20 +307,20 @@ def main(driver: Chrome, logger = logging.getLogger('main')):
|
|||||||
from openpyxl import load_workbook
|
from openpyxl import load_workbook
|
||||||
if status != Status.CLOSING: raise ValueError(status)
|
if status != Status.CLOSING: raise ValueError(status)
|
||||||
|
|
||||||
|
col = headers.index(column.sent) + 1
|
||||||
data = b64decode(b64)
|
data = b64decode(b64)
|
||||||
index = headers.index(column.sent)
|
|
||||||
buffer = BytesIO(data)
|
buffer = BytesIO(data)
|
||||||
target = load_workbook(buffer)
|
source = load_workbook(buffer)
|
||||||
|
|
||||||
for row in range(options.get('start'), limit + 1):
|
for row in range(options.get('start'), limit + 1):
|
||||||
c1 = wb.active.cell(row, index + 1)
|
c1 = source.active.cell(row, col)
|
||||||
c2 = target.active.cell(row, index + 1)
|
c2 = wb.active.cell(row, col)
|
||||||
if not (c1.value and str(c1.value).strip()):
|
if not (c1.value and str(c1.value).strip()):
|
||||||
if (c2.value and str(c2.value).strip()):
|
if (c2.value and str(c2.value).strip()):
|
||||||
c1.value = c2.value
|
c1.value = c2.value
|
||||||
|
|
||||||
io = BytesIO()
|
io = BytesIO()
|
||||||
wb.save(io)
|
source.save(io)
|
||||||
result = b64encode(io.getbuffer()).decode('ascii')
|
result = b64encode(io.getbuffer()).decode('ascii')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user