[Python] How to make python read file that user uploaded from user in android or iphone?

Discussão em 'Python' iniciado por Stack, Março 9, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to make a simple script where it reads an excel file and reads a specific column from it. as it is now, it reads a specific file, but I want that it has some integration with whatsapp. So, basically it will send a "welcome message" to the user then the user will be requested to upload a file. It has to be an excel kind of file. I've looked over internet for something like this, but I didn't find nothing. Here is how I am doing this:

    from datetime import datetime
    import pandas as pd
    from dateutil import parser
    import pywhatkit
    data_hoje = datetime.today()
    pywhatkit.sendwhatmsg("Abra uma planilha contendo as contas e as datas de vencimento:")
    #como será a entrada no whatsapp ou no telegram?
    planilha = pd.read_excel("/home/user/Documentos/planilhacontas.ods")
    df = pd.DataFrame(planilha)
    valores_validade = df["Data de Validade"].to_list()
    for valor in valores_validade:
    if type(valor) is str:

    valor_validade = parser.parse(valor)
    dias_restantes = valor_validade - data_hoje
    restante = str(dias_restantes).split(",")[0]
    print(restante)
    data_validade = valor_validade.strftime('%y-%m-%d')


    print(data_validade)
    else:
    dias_restantes = valor_validade - data_hoje
    restante = str(dias_restantes).split(",")[0]
    print(restante)
    print(dias_restantes)
    data_validade = valor_validade.strftime('%y-%m-%d')

    print(data_validade)

    print(dias_restantes)
    print(data_hoje)
    ````


    How to make this script read a file that was entered by a phone or even PC? and how I could make it on telegram as well?

    Continue reading...

Compartilhe esta Página