Xls batch doesn't work

Created on 27 April 2022, almost 3 years ago
Updated 28 August 2023, over 1 year ago

There are few issues I faced with XLS Data export and batch.

1. Empty file pre-created on first step of batch and then could not be read: "Unable to identify a reader for this file", because file doesn't contain xls headers.

Proposed solution: for xls(x) create empty spreadsheet object and save it into file instead of empty string.

2. If point 1 is solved, there are another issue that data of first batch operation is not stored into initialized file, so we loose header and first N rows (N - batch limit you configured).

Propesed solution: Remove condition by batch progress to write data into previous file, because before it wasn't written anywhere.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇷🇺Russia kiseleva.t

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    2 pass, 2 fail
  • 🇮🇳India PunamShelke India

    Added Patch #4 for release 8.x-1.3

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    2 pass, 2 fail
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    2 pass, 2 fail
  • Status changed to Needs work over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    3 pass
  • 🇦🇺Australia realityloop

    Tried #7 and still getting error

    An error has occurred.
    Continue to the error page
    
    An AJAX HTTP error occurred.
    HTTP Result Code: 500
    Debugging information follows.
    Path: /batch?id=150&op=do_nojs&op=do
    StatusText: error
    ResponseText: The website encountered an unexpected error. Try again later.PhpOffice\PhpSpreadsheet\Reader\Exception: Unable to identify a reader for this file in PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile() (line 172 of /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php). PhpOffice\PhpSpreadsheet\IOFactory::load('/var/www/html/web/sites/default/files/views_data_export/user_admin_people_data_export_1/1-1706833150/.xls') (Line: 849)
    Drupal\views_data_export\Plugin\views\display\DataExport::processBatch('user_admin_people', 'data_export_1', Array, Array, 20174, Array, '/', Array) (Line: 296)
    _batch_process() (Line: 138)
    _batch_do() (Line: 94)
    _batch_page(Object) (Line: 52)
    Drupal\system\Controller\BatchController->batchPage(Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 54)
    Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 41)
    Drupal\ip_login\StackMiddleware\IpLoginMiddleware->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
    Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 78)
    Drupal\ip_login\StackMiddleware\EarlyIpLoginMiddleware->handle(Object, 1, 1) (Line: 270)
    Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 137)
    Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
    
  • 🇳🇱Netherlands belthazorjk

    Hallo guys,

    I just had the same problem and after searching some more i found the problem.
    As mentioned here (https://github.com/PHPOffice/PhpSpreadsheet/issues/3930) PhpSpreadsheet function setCellValueByColumnAndRow was deprecated and is removed in 2.0

    So i just replaced that funtion with the new one and it works again.
    I il add the patch for anyone who needs it.

  • 🇮🇳India chetananemade

    Hi,
    The patch in #7 worked well for us with Drupal 10.2 and Views_data_export 1.4.
    However, after upgrading to Drupal 10.3 and Views_data_export 1.5, we have updated the patch in #7 to make it compatible with the new versions.

    The patch in #9 is already included in Views_data_export 1.5.

  • 🇬🇧United Kingdom steven jones

    @chetananemade thanks for the updated patch. We should try to get this into a MR instead of using patches.

Production build 0.71.5 2024