Index was out of bound of array while trying to write into excel file using excel loop

I’m new to assist edge.I’m getting Index was out of bound of array while trying to write into excel file using excel loop.Can anyone suggest a solution on this?

Hi,

Can you check if you are not trying to write a null value in excel

Regards,
Amit Anand

Hi Amit,

Thanks for your reply…I can view the value in output window before entering into excel loop.
Inside excel loop it is showing error like index out of bound even if the simple write line.

Regards
Hari

Hi,

Can you check the excel column name and variable name association.
For debugging, in a new process in excel loop add an excel, configure the variables by clicking on setiing icon and write line the value
Also, check if it is happening for every excel on your machine or it is specific case with one excel.

Regards,
Amit Anand

Hi Amit,
I want to write multiple columns into newly created excel sheet. How can we proceed with that?

This is simple @omkars .
If you want to create a new excel -

Just create data table using Data Table activity.
Add columns to this Datatable and export the data table at a specified path.

PFB Screenshot of flow.

In case you want to create multiple columns in an existing excel sheet, then you can use Excel Recorder.

Hi,

If you are using excel loop then you can add multiple write to excel activity and in each select different columns in which you want to write

Else,
use the data table approach as suggested above

Regards,
Amit

Hi
I am new to assist edge. I was trying to extract values from a pdf and write it into excel file using excel loop. But i am getting “index out of bound array error” even the mapping of argument is correct against column names in write to excel activity. Can anyone suggest solution for this?

Hi @shraddha08

In this scenario, I assume your excel file which you’re looping is blank and only contains headers. There’s no point of using Excel Loop as it iterates the existing excel rows within the selected Excel sheet.

For your PDF extraction use case, what you can do is that you can create the data table first using Create Datatable Activity. Then Add the row in the Datatable using Add Row Activity. Map the row values with the extracted data from PDF and then Export the Datatable using Export Datatable Activity.

Otherwise, if you still want to use Excel loop, then I would suggest adding dummy rows in your Excel File. For example, add Sr. No in the first column and add rows till which you expect the data to get filled.

Please mark this answer as solution if it works for you.

2 Likes

Hi @Mantri Sir,

First of all thank u for your reply…
I have tried above solutions and both are working perfectly fine.

thank you again :slight_smile:

Regards,
Shraddha

How to insert array of strings into excel which is tabular data extracted from pdf??
I tried with data table approach but only datatype of that variable is stored in excel

@nagarjun
What I understood from your scenario is that you have tabular data which you’re trying to extract from a pdf.
The PDF Extractor activity is capable to directly export extracted tabular data from the PDF into csv format.
In the properties pane of PDF Extractor activity you can find the property FolderPath. Upon specifying the folder path the csv will get exported as the location.
Hope this helps.

1 Like