27
Views
6
Comments
Solved
I Have Problem Regarding Excel validation.
Question

Hey,

I Everyone I am new to service studio and I don't know how to check Uploaded excel file in upload Widget, After I click Upload Button its check Uploaded excel file is empty, Then I need to show Error/Warning like your Uploaded excel file is Empty file otherwise Excel Data Added Successfully. 

I Attach my oml file just go through this file.

Please Guide Me to complete this Task...

ExcelUploading.oml
2022-12-22 10-00-39
Beatriz Sabino
Solution

Thank you for the information.

I’ve updated the .oml again.

I used the Forge component Advanced Excel to retrieve the properties of the uploaded file and check if it contains more than one row (which would be the header). This logic is implemented in the server action ExcelFile_GetProperties.

Since it's best practice to have only one server action in a client action, I created a new server action called ExcelFile_Upload, which encapsulates the logic to check if the Excel file is empty and to create records in the database. 

In the client action UploadOnClick, I call the newly created server action. If the file is empty, a message is displayed to the user. I also kept the condition to check whether the user has uploaded a file, just to ensure that an actual file is selected. 

ExcelUploading_Updated.oml
2022-12-22 10-00-39
Beatriz Sabino

Hi Sagar,

I've updated your .oml file. 

In the client action UploadOnClick, I added an If condition to check if the FileContent is null. If it is, a warning message will be displayed to the user. 

I also added an attribute to the upload widget to restrict file uploads to only accept Excel files. 

ExcelUploading_Updated.oml
2025-10-09 13-52-02
Sagar Andyal

Hey Beatriz Sabino,

Its Not Working Properly, when I upload Empty_Excel file it show the warning But Is Showing Data Will Added Successfully.

I Attach Excel file just see it.

Empty_Entities.xlsx
2022-12-22 10-00-39
Beatriz Sabino

Hi Sagar,

Ok, so the condition FileContent = NullBinary() won't work, because the file will never be exactly 0 bytes, even if it's completely empty. 

Before I provide a proper solution, could you confirm if the Excel file you sent is the only template you want to check for blank content? Will the Excel file always contain a header? 

2025-10-09 13-52-02
Sagar Andyal

Ya it is only template, and If Contains Any Header otherwise  no need. 

2022-12-22 10-00-39
Beatriz Sabino
Solution

Thank you for the information.

I’ve updated the .oml again.

I used the Forge component Advanced Excel to retrieve the properties of the uploaded file and check if it contains more than one row (which would be the header). This logic is implemented in the server action ExcelFile_GetProperties.

Since it's best practice to have only one server action in a client action, I created a new server action called ExcelFile_Upload, which encapsulates the logic to check if the Excel file is empty and to create records in the database. 

In the client action UploadOnClick, I call the newly created server action. If the file is empty, a message is displayed to the user. I also kept the condition to check whether the user has uploaded a file, just to ensure that an actual file is selected. 

ExcelUploading_Updated.oml
2025-10-09 13-52-02
Sagar Andyal


Dear Beatriz Sabino , I sincerely appreciate your help with this task. Your support was invaluable for me. Thank you...…

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