60
Views
10
Comments
[FileSystem] How to convert Binary File read from FileSystem to CSV?
filesystem
Service icon
Forge asset by João Portela
Application Type
Reactive

Dear all,

I have a Example.xlsv file with number of sheet, which are read by using the [FileSystem] File_ReadBinary.

The output of File_ReadBinary is binary file, and I'd like to convert this binary file to number of CSV files based on the number of sheets in the original Example.xlsx.

Please advice me on this.

Thank you.

UserImage.jpg
Alexandre Yip

Hi Cuong Tran, 

Please check the bellow post

https://www.outsystems.com/forums/discussion/90519/advanced-excel-help-with-advance-excel-import/

Hope that it helps you 

UserImage.jpg
Cuong Tran

Hey Alex,

Thank you for your quick reply. I have tried the method from your reference, and I have some question.

Here is my logic flow:


  1. Read excel file from URL
  2. Open Workbook by the binary input
  3. Select worksheet from the input Workbook
  4. Convert the selected Sheet to CSV from the input of selected sheet.

And there was a error at Step#4:

Apparently, the input for Record List in step 4 is not correct. 

The output of Worksheet_Select is "Sheet 1", which is the first sheet of the workbook. Beside the sheet name, is there any data else out of this Worksheet_Select action?

UserImage.jpg
Cuong Tran

Found something from @Hanno related to output datatype of Worksheet_Select years ago.

Just wanted to add here for reference:

https://www.outsystems.com/forums/discussion/32853/advanced-excel-worksheet-name/

2019-01-07 16-04-16
Siya
 
MVP

Please find attached a reference implementation. I used the Excel Tools Forge component to convert the Excel file to CSV. Since this tool only converts the first sheet, I utilized Workbook_ChangeSheetIndex to shift the sheet index. Additionally, the number of sheets is passed from the UI as I couldn’t find a way to get the number of sheets programmatically.

SplitExcel.oml
UserImage.jpg
Cuong Tran

Hi @Siya,

Thank you for your reply.

Unfortunately, the mentioned Excel tool component is not available to use in my company.

What I have at the moment is Advanced  Excel, CSVUtil...


2019-01-07 16-04-16
Siya
 
MVP

One option would be to traverse each cell using Cell_ReadByIndex, create comma-separated values for each cell per row, separate each row with a new line, and return the final string.

UserImage.jpg
Cuong Tran

Hi,

That is also my current solution actually. And I found it quite cumbersome with large dataset.

2019-01-07 16-04-16
Siya
 
MVP

Could you please ask the Platform team to install the Excel Tool component? If they can install CSVUtil or Advanced Excel, they should be able to install this one as well. I don’t see any other options.

UserImage.jpg
selva raj

HI Cuong Tran,


for this ExportRecordList2CSVbBinary function you can use : To Object(Record List file) , for change excel file to CSV file

UserImage.jpg
Cuong Tran

Thank for your reply. I tried that and still same error message.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.