'Get specific data from excel spreadsheet and print/execute a command in python
I have an excel file that has a list of people, their address, phone numbers, message and many other columns. I need to create a loop that will check each cell value and print (later execute) specific columns.
i need to print the following (for each line)
Hi {First Name},
{Message - Column}
once i have this right, I will need to execute the following for each line.
client.send_sms({mobile number}, {message})
I have this code currently but having problems understanding how to loop this into executing the client.send_sms. thanks
import pandas as pd
import numpy as np
file_loc = "C:/Users/jack/Downloads/text.xlsx"
df = pd.read_excel(file_loc, index_col=None, na_values=['NA'], usecols = "A,I,J")
print(df)
Solution 1:[1]
This is how you can check the value of each column (row[0] is the first column).
for row in open("file.csv"):
name = row[0]
msg = row[10]
print('Name'+name +' '+ 'Message:'+ msg)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | marc_s |
