Read Attached excel file per cell via script

ariesmanlangit
Kilo Expert

Hi guys,

        I just want to know if there is a way where in I can able to access the rows,columns and/or cells in an attached excel file via script..

find_real_file.png

        In my scenario, I need to add the values from the attached file and add it into a custom table via gliderecord. Is there any way I can access the values per row,column and put it in a loop?

        //sample layout

        //code block here

        var addGroups = new GlideRecord('u_group_names');

     

        //add a while where to access the cells of the attached excel

        while(<rows not on limit>)

                  while(<columns not on limit>)

        addGroups.initialize();

        addGroups.u_group_name = attachedFile.rows(x).columns(y);

        addGroups.insert();

                  }

        }

Something like that.

Hoping this is possible.

Thanks,

a.c.manlangit

ServiceNow Developer - Philippines

9 REPLIES 9

Chuck Tomasi
Tera Patron

You might find this thread helpful.



Working with Attachment Data


Hello Chuck!


        When I started servicenow last year, I always watched your videos hehehe Well, Thanks for the link by the way.. But I am looking for a more specific code in which I am able to access the cells of the attached excel file and manipulate it. Somewhat like that, is there a way to this? Like for example I needed to get the value of the cell 2E in the attached excel file in the RITM/TASK? hehe



Thanks,


a.c.manlangit


serviceNow Developer - Philippines


Hi Ariestotle,



Thanks for watching the videos. We're still making them!



As for manipulating spreadsheets, there are no APIs that I'm aware of to do that without first loading the information in to a table first.


Hello Chuck,



I was trying to invoke macros(excel) vba code in scripting to automate the process of generating graphs in excel, I was facing problem to access the excel document through scripting, is there any way I can achieve this ??