Skip to content

Instantly share code, notes, and snippets.

@jtn-ms
Forked from jkgiesler/deep_excel.py
Created February 24, 2017 09:31
Show Gist options
  • Save jtn-ms/cc19cf4ce577084ac694cff85c4d7e03 to your computer and use it in GitHub Desktop.
Save jtn-ms/cc19cf4ce577084ac694cff85c4d7e03 to your computer and use it in GitHub Desktop.
from __future__ import print_function
import numpy as np
from xlwings import Workbook, Range
#Deep excel not included please find it here: http://www.deepexcel.net/
def run_test_data():
with open('test.csv','rt') as f:
with open('result.csv','wt') as r:
headers = f.readline()
for line in f:
data = line.strip()
row = data.split(',')
mat = np.reshape(row,(28,28))
wb = Workbook.caller()
Range('input','A1:AB28').value = mat
fit = Range('input','B31:K31').value
fit = [str(i) for i in fit]
print(','.join(fit),file = r)
Sub MyMacro()
RunPython ("import test;test.run_test_data()")
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment