如何从CSV读取数字并发送到所有这些数字 [英] How to read numbers from a CSV and send to all of those numbers

查看:109
本文介绍了如何从CSV读取数字并发送到所有这些数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我开发了一个可以向一个人发送短信的程序。但是我还想添加批量发送选项。为此,我认为使用该应用程序的人可以简单地上传带有一堆手机号码的CSV文件,然后将消息发送到所有这些号码。有谁知道这方面的好教程?我在谷歌上找不到任何东西,说实话我甚至都不知道要搜索什么。



基本上,我想点击按钮上传CSV文件。该程序应该通过CSV文件,然后发送短信到CSV文件中的每个数字。



任何帮助将不胜感激!



问候,

Chris

Hi All,

I have developed a program that can send an SMS to a single person. However I also want to add a bulk sending option. For this I thought that the person using the application could simply upload a CSV file with a bunch of cell phone numbers and then have the message sent to all of those numbers. Does anyone know of a good tutorial in this? I cannot find anything on google and to be honest I do not even know what to search for.

Basically, I want to click a button to upload a CSV file. The program should go through the CSV file and then send a text message to every number found in the CSV file.

Any help would be greatly appreciated!

Regards,
Chris

推荐答案

您不需要CSV。如果您的记录包含多个必须彼此分开的值(列),则CSV变得有用。但是根据你在问题中所写的内容,你想要的只是一个电话号码列表。因此,只需将它们放在文本文件的单独行中,使用 File.ReadLines(..) [ ^ ],它将返回一个IEnumerable< string>将该文件中的所有行(=电话号码)。使用foreach循环迭代它,调用现有方法在该循环中发送SMS并完成:)
You don't need CSV. CSV becomes useful if your records consist of multiple values (columns) that have to be separated from each other. But from what you're writing in your question, all you want is a list of phone numbers. So just have them in separate lines in a text file, open the text file with File.ReadLines(..)[^], which will return you an IEnumerable<string> will all the lines (= phone numbers) in that file. Iterate over that with a foreach-loop, call your existing method that sends the SMS within that loop and you're done :)


这篇关于如何从CSV读取数字并发送到所有这些数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆