douju3911 2017-06-26 04:28
浏览 70
已采纳

从excel进入网页的数据

I have an excel file with 3 columns, "First name", "Last name", "email" and about 700 entries (rows). I also have a website with a form for first name, last name and email. Obviously I don't want to type out all 700 entries manually. Is there a way to get these columns from excel and enter them into the online form? Perhaps using visual basic/php or any other alternative. If such code already exists then it would be great if somebody could show me. If not, then it would be appreciated if somebody could give some advice on how to approach this. Thanks!

  • 写回答

2条回答 默认 最新

  • drll85318 2017-06-26 04:44
    关注

    PHP has a CSV method, you can convert/save your excel file to csv and process if using PHP.

    Reading the File in PHP

    Example 1

    How to create an array from a CSV file using PHP and the fgetcsv function

    $file = fopen('youruploadedfile.csv', 'r');
    while (($line = fgetcsv($file)) !== FALSE) {
      // each line of the array
     print_r($line);
    }
    fclose($file);
    

    Example 2

    https://www.w3schools.com/php/func_filesystem_fgetcsv.asp

    $file = fopen("youruploadedfile.csv","r");
    
    while(! feof($file))
    {
     print_r(fgetcsv($file));
    }
    fclose($file);
    

    check out https://www.w3schools.com/php/func_filesystem_fgetcsv.asp

    Definition and Usage

    The fgetcsv() function parses a line from an open file, checking for CSV fields.

    The fgetcsv() function stops returning on a new line, at the specified length, or at EOF, whichever comes first.

    This function returns the CSV fields in an array on success, or FALSE on failure and EOF.


    Selenium

    Selenium is a tool to automate user interface testing. It helps with testing your application against the browser

    Take a look at the web driver https://github.com/facebook/php-webdriver

    There is also varied information on how to's on SO. How to use Selenium with PHP?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog