Syntax help parsing Excel into a table

gjz
Mega Sage

I have created a custom app.  As part of the app, I need to parse an Excel spreadsheet and create records from the data in the spreadsheet.  I chose not to use an import for various reasons, although I may be stuck doing that.

 

I'm using a flow that reads the spreadsheet data and creates rows in a staging table.  I'm not having trouble parsing the spreadsheet, but I am having trouble entering it into a staging table because of the headers.

 

The spreadsheet has column headers like "Asset", "Port", "First Found On", "Name".  

 

I've created an action in Flow - here is the script in the action that is working:

gjz_1-1724457213334.png

 Because logging isn't working with my scoped app (I've opened a Support ticket), I'm unable to determine  what the JSON rows and data look like in the action by checking the execution log or script/application logs.

 

Using a fix script, I was able to determine I can only retrieve the value if I use the exact header - in this case "Asset" must be used and not "asset".

 

The fix script code

       gs.print('### Asset: ' + parsed.Asset + ' / ' + parsed.asset);

returns the output

gjz_2-1724457680594.png

 

With a multi-word column header like "First Found On", what is the correct syntax to set the value to the corresponding field in my staging table?

 

var s = new GlideRecord('my_staging");

s.initialize();

s.setValue('name', parsed.Asset);

s.setValue('first_found_on', parsed.????);

 

 

 

 

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@gjz In case of the properties made up of multiple words, you can try the following.

 

var s = new GlideRecord('my_staging");

s.initialize();

s.setValue('name', parsed.Asset);

s.setValue('first_found_on', parsed["First Found On"]);

 

Hope this helps.

View solution in original post

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@gjz In case of the properties made up of multiple words, you can try the following.

 

var s = new GlideRecord('my_staging");

s.initialize();

s.setValue('name', parsed.Asset);

s.setValue('first_found_on', parsed["First Found On"]);

 

Hope this helps.

gjz
Mega Sage

@Sandeep Rajput 

Thank you Sandeep, it worked.