Well, the bot only needs the cellphone numbers of the customers; however, occasionally, the files contain emails and messages. I want to clean up the excel file so that it only contains the numbers and removes any extraneous columns.
// Assuming dtInput is your DataTable containing the Excel data
// Replace “PhoneNumber” with the actual column name containing the phone numbers
// Select only rows where the “PhoneNumber” column is not null or empty
Dim filteredRows = dtInput.AsEnumerable().Where(Function(row) Not String.IsNullOrWhiteSpace(row(“PhoneNumber”).ToString())).CopyToDataTable()
// Create a new DataTable with only the “PhoneNumber” column
Dim dtCleaned As DataTable = New DataTable()
dtCleaned.Columns.Add(“PhoneNumber”)
// Copy filtered phone numbers to the new DataTable
For Each row As DataRow In filteredRows.Rows
dtCleaned.Rows.Add(row(“PhoneNumber”).ToString())
Next
// Assign the cleaned DataTable to the original DataTable variable
dtInput = dtCleaned