PHP Classes

Simple Coop Uploads API: Store financial data in SQL server from Excel file

Recommend this page to a friend!
  Info   View files Example   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 111 This week: 1All time: 9,613 This week: 560Up
Version License PHP version Categories
simple-coop-uploads- 1.0.0The PHP License5PHP 5, Databases, Finances, Applications
Description 

Authors

Maarten Balliauw
Mark Baker
Franck Lefevre
Erik Tilt
Adrien Crivelli


Contributor

This package can store financial data in an SQL server from an Excel file.

It provides a form script to upload an Excel spreadsheet in XLSX format.

The package also provides a class to process the uploaded Excel spreadsheet files, parse the file to extract financial value, and store the values in SQL server details.

Innovation Award
PHP Programming Innovation award nominee
April 2023
Number 3
Companies develop many PHP applications to serve the needs of the financial department.

Often companies create spreadsheets with financial numbers and calculations with the Excel application.

This package provides a simple application that demonstrates how to upload an Excel spreadsheet file to Web site running PHP and then extract details from the spreadsheet to store in a SQL server database table, so the stored data may be used by other parts of the PHP Web site.

Manuel Lemos
Picture of Okanlawon Anuoluwapo
  Performance   Level  
Name: Okanlawon Anuoluwapo <contact>
Classes: 4 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 364028 in Nigeria Nigeria
Week rank: 411 Up10 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 3x

Example

<?php require __DIR__ . '/init.php'; ?>
<!DOCTYPE html>
<html lang="en" >
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Upload External Files</title>
    <!-- CSS only -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0" crossorigin="anonymous">
  </head>
  <body style="background: #efffee;">
    <div class="container">
      <div class="row">
        <section>
          <p>&nbsp;</p>
        </section>
      </div>
      <div class="row">
        <?php
       
if (isset($_POST['uploadnow'])) {
         
// upload loan sheet
         
$res = $upl->uploadLoan();
         
// upload transaction sheet
          // $res = $upl->uploadTransaction();
          // response
         
if ( $res === "success" ) {
           
$success = $res;
            echo
"<script>setTimeout(function() { window.location.reload(true); }, 1000);</script>";
          } else {
           
$error = $res;
          }
        }
       
?>
<div class="col-lg-8 col-md-8 col-sm-12">
          <div class="card">
            <div class="card-header">
              Make your upload here
            </div>
            <div class="card-body">
              <?php if ( !empty($success) ): ?>
<div class="alert alert-info"><?=$success?></div>
              <?php endif; ?>
<?php if ( !empty($error) ): ?>
<div class="alert alert-danger"><?=$error?></div>
              <?php endif; ?>
<form class="form_upload" method="post" enctype="multipart/form-data">
                <div class="form-group row">
                  <!-- <label for="docfile" class="col-md-3">Choose File to Upload<span class="text-danger">* </span></label> -->
                  <div class="col-md-9">
                    <input class="form-control" type="file" name="docfile" required>
                  </div>
                  <div class="col-md-3">
                    <button type="submit" class="btn btn-primary" name="uploadnow">Upload Now</button>
                  </div>
                </div>
              </form>
            </div>

          </div>
        </div>
      </div>
    </div>

    <!-- JavaScript Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs/ZVWx6oOypYoCJhGGScy+8" crossorigin="anonymous"></script>
  </body>
</html>


Details

simple-coop-uploads-api

Simple PHP and Sql Server API to serve uploads for web applications

PhpSpreadsheet

Uploads with Php Spreadsheet plugin

Format includes: spreadsheet sheets, xls, xlsx, csv

 [
  'application/vnd.ms-excel',
  'text/xls',
  'text/xlsx',
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  'text/csv'
 ]

Modify the init file to your own database connection


  Files folder image Files  
File Role Description
Files folder imageclasses (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file init.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  classes  
File Role Description
  Plain text file uploadController.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:111
This week:1
All time:9,613
This week:560Up