Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:41:17+00:00 2026-06-07T00:41:17+00:00

Solved Hi currently im using SimpleXLSX to parse the xlsx (excel file), all the

  • 0

sample xlsx

Solved
Hi currently im using SimpleXLSX to parse the xlsx (excel file), all the empty cell values are removed while return the array values,but I need to keep empty/NULL value of any cell in return value

     $xlsx = new SimpleXLSX($uploadfile);
     $j =1;
     //list($num_cols, $num_rows) = $xlsx->dimension();  //Previous
       $items = array();
        list($cols,) = $xlsx->dimension($j);        


    print_r($xlsx->rows());
    //foreach ($xlsx->rows() as $r) { //Previous 
     foreach( $xlsx->rows($j) as $k => $r) {  //fixed
        // if ($i != 0) {
     // for( $i=0; $i < $num_cols; $i++ )//Previous 
       for( $i = 0; $i < $cols; $i++) //fixed
    if(!empty($r[$i]))
                            {
                                $v = $r[$i];
                            }else{

                                $v = '&nbsp;';
                            }
                           // echo $v;
                             $items[$i]  = $v;
                        //   

    }
           $val = implode('|', $items);
 O/P:

 Array
(
[0] => Array
    (
        [0] => Name of the Candidate
        [1] => phone number
        [2] => Postal Address 
        [3] => mobilenumber
        [4] => country
    )

[1] => Array
    (
        [0] => abc
        [2] => 123, 
        [4] => india
    )

[2] => Array
    (
        [0] => fsdfsf
        [1] => 23423423
        [3] => 3223423423
        [4] => us
    )

 )   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:41:19+00:00Added an answer on June 7, 2026 at 12:41 am

    Untested code:

    <?php
    
    $xlsx = new SimpleXLSX($uploadfile);
    list($num_rows, $num_cols) = $xlsx->dimension();
    
    $values = [];
    foreach ($xlsx->rows() as $r)
    {
        $rowValue = '';
    
        for ($j = 0; $j < $num_cols; $j++)
        {
            $rowValue .= !empty($r[$j]) && $r[$j] != '' ? $r[$j] : 'null';
        }
    
        $values[] = $rowValue;
    }
    
    var_dump($values);
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using codeigniter and .htaccess rewriting. Currently it's rewriting all non-existing file queries to
My Java application is currently using ZIP as a project file format. The project
I'm currently working on project euler problem 14 . I solved it using a
I'm currently using Twisted 10.1 to receive and parse UDP packets, but the standard
I have a query that is currently using a correlated subquery to return the
I'm currently using a Zend Controller Plugin to check authentication. The following probably looks
I'm trying to hook a CBT hook on Windows OSes. I'm currently using Windows
I am currently working on a project that uses CoreData and relations are using
Currently I'm using GetFileSizeEx to track how large a log files gets before I
EDIT I solved the issue by forking the process instead of using threads. From

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.