'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
        'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
    ]
    # columns = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U']
    # columns = ['V', 'W', 'X', 'Y', 'Z']
    # columns = ['H']

    max_rows = 3
    # max_rows = 3
    addresses = [
        'Sheet1!{}{}'.format(column, row) for row in range(2, max_rows)
        for column in columns
    ]

    print("addresses made", datetime.now() - beginning)
    second_beginning = datetime.now()
    for address in addresses:
        evaluated_value = excel.evaluate(address)
        excel.set_value(address, evaluated_value)
        print("EVALUATED VALUE", address, evaluated_value)

    print("Evaluation done", datetime.now() - second_beginning)
    print("all done", datetime.now() - beginning)

    # # show the graph using matplotlib if installed
    # print("Plotting using matplotlib...")
    # try:
    #     excel.plot_graph()
    # except ImportError:
    #     pass
Ejemplo n.º 2
0
if __name__ == '__main__':
    pycel_logging_to_console()

    path = os.path.dirname(__file__)
    fname = os.path.join(path, "example.xlsx")

    print(f"Loading {fname}...")

    # load & compile the file to a graph
    excel = ExcelCompiler(filename=fname)

    # test evaluation
    print(f"D1 is {excel.evaluate('Sheet1!D1')}")

    print("Setting A1 to 200")
    excel.set_value('Sheet1!A1', 200)

    print(f"D1 is now {excel.evaluate('Sheet1!D1')} (the same should happen in Excel)")

    # show the graph using matplotlib if installed
    print("Plotting using matplotlib...")
    try:
        excel.plot_graph()
    except ImportError:
        pass

    # export the graph, can be loaded by a viewer like gephi
    print("Exporting to gexf...")
    excel.export_to_gexf(fname + ".gexf")

    # As an alternative to using evaluate to put cells in the graph and
Ejemplo n.º 3
0
if __name__ == '__main__':
    pycel_logging_to_console()

    path = os.path.dirname(__file__)
    fname = os.path.join(path, "example.xlsx")

    print("Loading %s..." % fname)

    # load & compile the file to a graph
    excel = ExcelCompiler(filename=fname)

    # test evaluation
    print("D1 is %s" % excel.evaluate('Sheet1!D1'))

    print("Setting A1 to 200")
    excel.set_value('Sheet1!A1', 200)

    print("D1 is now %s (the same should happen in Excel)" % excel.evaluate(
        'Sheet1!D1'))

    # show the graph using matplotlib if installed
    print("Plotting using matplotlib...")
    try:
        excel.plot_graph()
    except ImportError:
        pass

    # export the graph, can be loaded by a viewer like gephi
    print("Exporting to gexf...")
    excel.export_to_gexf(fname + ".gexf")