I want like After Uploading a excel file i have got the row count by converting into record list and got the rows count but i wanted to find out how many coloumns present in the uploaded excel File and pass it to a variable
Hello Sathwik Karamsetty,
I understand your requirement. In OutSystems, by default you can get the row count from an uploaded Excel by converting it to a record list, but there isn’t a built-in way to detect the number of columns or their types dynamically.
I’ve created a small extension that can help with this. You just need to pass the uploaded Excel file (as binary) and the sheet name, and it will return:
Row count
Column count
Details of each column, including the header and detected data type (Text, Number, Date, Boolean)
For example, after uploading a file, the extension can return:
Column count: 16 Row count: 701 [ {"ExcelColumnDetail":{"Index":1,"Header":"Segment","DataType":"Text"}}, {"ExcelColumnDetail":{"Index":2,"Header":"Country","DataType":"Text"}}, {"ExcelColumnDetail":{"Index":3,"Header":"Product","DataType":"Text"}}, {"ExcelColumnDetail":{"Index":4,"Header":"Discount Band","DataType":"Text"}}, {"ExcelColumnDetail":{"Index":5,"Header":"Units Sold","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":6,"Header":"Manufacturing Price","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":7,"Header":"Sale Price","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":8,"Header":"Gross Sales","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":9,"Header":"Discounts","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":10,"Header":"Sales","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":11,"Header":"COGS","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":12,"Header":"Profit","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":13,"Header":"Date","DataType":"Date"}}, {"ExcelColumnDetail":{"Index":14,"Header":"Month Number","DataType":"Number"}}, {"ExcelColumnDetail":{"Index":15,"Header":"Month Name","DataType":"Text"}}, {"ExcelColumnDetail":{"Index":16,"Header":"Year","DataType":"Text"}} ]
This demonstrates exactly what you’re looking for. I’ve also attached the Excel file I used for testing so you can see how the extension works with real data. However, the extension itself is quite large (around 14 MB), which exceeds the file sharing limits here, so I cannot provide it directly.
If you’re interested in using this functionality, please contact me and I can guide you on how to integrate it into your OutSystems environment.
Best regards, Claudio
@Sathwik Karamsetty : You can use the SheetJS JavaScript library to get the column count on the client side, avoiding server-side processing. In fact, the library allows you to offload many Excel-related tasks from the server to the client.
Hello @Sathwik Karamsetty
I made one exmple for you just check it's usefull for you or not i used SheetJS for this
https://personal-l9q0mrdp.outsystemscloud.com/ExcelJS/Test