How to read excel file before CI submission?

gunishi
Tera Guru

Hi all,

 

I have a requirement where the user must attach an excel file on a request for a catalog item. 

 

I want to read the excel doc before submission to check that the excel doc has the right columns. I also want to extract some data that will be used to fill in some of the fields on the CI form. 

 

How would I go about this?

 

I know to use GlideExcelParser to look in the document, but first I need to be able to find the excel file. 

 

I have the following code but it is not working:

 

var sys_id = g_form.getValue('sysparm_item_guid');

 

I also have this piece of code as an option, but I don't really understand how to use it/how to actually reurn the sys_id of the actual excel document that can then be put through the GlideExcelParser functions:

 

var attachment = new GlideRecord('sys_attachment');

attachment.addQuery('table_name', 'sc_cart_item');

attachment.addQuery('table_sys_id', sys_id);

 

Thank you so much in advance, 

G

 

1 REPLY 1

Rithika Gaddi1
Tera Contributor

Hello gunishi , have you got this isue solved ? I actually have to check the columns of excel what should be done ?