in reply to Re^3: string TRUE/FALSE getting converted to 1/0
in thread string TRUE/FALSE getting converted to 1/0

My sincere apologies and I understand your point. The conversion from xls to csv is working fine meaning input data matches output data. The issue is with second part of this code which is converting XLSX data to csv (line 114 to 190). Here in the output data the TRUE/FALSE strings are getting converted to 1/0 and this is the part I need some help - how to skip or avoid this conversion of TRUE/FALSE strings - leave them as is in the output - same as input. Appreciate your help and time.

  • Comment on Re^4: string TRUE/FALSE getting converted to 1/0

Replies are listed 'Best First'.
Re^5: string TRUE/FALSE getting converted to 1/0
by soonix (Chancellor) on Jun 16, 2015 at 10:43 UTC
    I see two possibilities:
    • Excel might store the information differently. If can open the XLSX file with your Excel and then "save as" XLS, how do these "TRUE/FALSE" fields look like, when freshly opening the (new) XLS file in Excel?
    • According to the doc, Spreadsheet::XLSX wants to be compatible with Spreadsheet::ParseExcel, but perhaps it isn't. Another module is Spreadsheet::ParseXLSX, which also tries to be a drop-in replacement.
      Thanks for your response Soonix. I have tried converting the XLSX to XLS and then to csv using this script and that is converting as intended. As for Spreadsheet::ParseExcel, it is compatible only for excel 95-2003 binary formats. Spreadsheet::XLSX is compatible for excel 2007 Raj
        you misunderstood my second bullet point. The modules try to be "exchangeable", so it should be possible to write something like
        my $excel_obj; if ($ext eq ".xls") { $excel_obj = Spreadsheet::ParseExcel->new(); } elsif ($ext eq ".xlsx") { $excel_obj = Spreadsheet::ParseXLSX->new(); } elsif ($ext eq ".ods") { $excel_obj = Spreadsheet::ReadSXC->new(); } else { die "Extension $ext not (yet) supported..."; } my $workbook = $excel_obj->Parse( ... );
        and have just one loop through the spreadsheet, instead of one for each file type.
        That said, looks like someone (Tux) already took a similiar approach and wrote Spreadsheet::Read