Importing EXCEL data for PHP!

0

Hello, I've come to ask for help regarding EXCEL and PHP; Shortly after I joined a company, where there is a dashboard made in VBA in EXCEL, however, I realized that it gives a lot of trouble. So I decided to develop a new dashboard, remove from VBA and go to the Browser (HTML5, PHP and Mysql because it has login system and password).

The dashboard in excel does the following:

  • When you press the green arrow it begins to do its functions
  • With the extension of SELENIUM, it automatically accesses the site, downloads the worksheets in Excel and places the values in the dashboard
  • Every 4 minutes it deletes everything in the download folder (where the files are downloaded) and does this all over again, always updating the data;

Here is the dashboard image: link

It prints the values on the screen all cute, goes up the bar there where the "Planned x Produced", calculates the percentage, etc ...

I want to migrate all this to Browser, for PHP. I want him to do the same of these features of it. But how?! How to make PHP also access the site automatically, dowload and play everything on the screen?

NOTE: I will use the same excel dashboard template in the browser ... Save the PNG image and put it in the browser and then play the information above? Or do I do the same 0 dashboard?

Thank you very much for helping me! I'm getting a lot of code snippets of this kind on the internet, but nothing concrete.

    
asked by anonymous 08.06.2017 / 15:59

2 answers

0

There were several questions in just one question, so let's take a look:

  • You should develop a dashboard from scratch, so it will be easier to service in the future.
  • On accessing the site file, you can make a copy of it to /tmp of your project, using the Copy . So if you need to manipulate the file again you do not need to re-apply to the site. Here's an example using Copy :

    $url = "http://site.com/arquivos/nome.csv";
    if (copy($url, '/tmp/' . urldecode(basename($url)))) {
        echo 'Arquivo copiado com sucesso!';
    } else {
        echo 'Erro ao copiar arquivo!';
    }
    
  • To manipulate .csv files in php, follow a answer in the Stack on the subject;

  • To manipulate the information in the html . It's not the best way, but since you're at the beginning, it helps;

  • I believe I answered all the information I had described. If you have more questions, ask questions on the Stack. When more description is better, it will help.

        
    29.06.2017 / 15:50
    2

    Yes, you can do this via PHP as well.

    You will need to download the file using PHP's file_get_contents () function.

    You will need to use a library to read the contents of Excel files, such as: link

    Or: link

    I suggest you create the dashboard from scratch with HTML and CSS instead of generating an image and overlaying the data.

        
    08.06.2017 / 17:13