0

I am trying to import an excel file on a webpage with a submit button. As far as I can tell, the only way to do so is to use PhpSpreadsheet. How can one incorporate PhpSpreadsheet with $wpdb and wordpress?

1 Answer 1

0

I'm assuming you mean this PhpSpreadsheet; if not, please edit your question to clarify.

To incorporate any third-party PHP library into your WordPress site, you'll either need to write a plugin or find one that already does what you need.

The PhpSpreadsheet docs explain how you'd incorporate their library into any PHP application, which includes a WordPress plugin.

composer require phpoffice/phpspreadsheet
composer install

on the command line (in your plugin's root directory) will ensure that the required library|ies are installed. Then, in the plugin's code,

<?php

require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

...will load the required PHP files and set you up to read and write XLSX files.

Without knowing more about how PhpSpreadsheets works, it's hard to say much more. You'll have to explore their documentation to see how to use their product. Note that third-party product support is off topic here.

If you're not comfortable writing a plugin, and there's not one already in the WP ecosystem that does what you need, you'll have to find someone who can and will do it for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.