web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / gettting an error Line...
Power Automate
Unanswered

gettting an error Line 5: alllines is not iterable while converting csv to xlsx

(0) ShareShare
ReportReport
Posted on by 10

I am trying to parse CSV file as per the instructions from this video How to Parse a CSV in Microsoft Power Automate Super Fast, Free and Easy. - YouTube by Paulie M. Below the snap of the flow.

 

Getting eeror in excel code like Line 5: alllines is not iterable while converting csv to xlsx 

 

these is my excel code 

function main(workbook: ExcelScript.Workbook, lineCSV: string[]) {
  let selectedSheet = workbook.getActiveWorksheet();
  const alllines=lineCSV;
  let counter = 1;
  for (let line of alllines){
    if (line.includes(",")) {
      let items = line.split(",");
      selectedSheet.getRange("A1" + counter + ":I1" + counter).setValues([[items[0], items[1], items[2], items[3], items[4], items[5], items[6], items[7], items[8], items[9], items[10], items[11], items[12], items[13], items[14], items[15], items[16], items[17], items[18], items[19], items[20], items[21], items[22], items[23], items[24], items[25]]]);
      counter++;
    }
  }
  // Set width of column(s) at range A:A on selectedSheet to 114
  selectedSheet.getRange("A:A").getFormat().setColumnWidth(114);
  // Set width of column(s) at range C:C on selectedSheet to 129.75
  selectedSheet.getRange("C:C").getFormat().setColumnWidth(129.75);
  // Set width of column(s) at range E:E on selectedSheet to 75
  selectedSheet.getRange("E:E").getFormat().setColumnWidth(75);
  // Set width of column(s) at range F:F on selectedSheet to 114
  selectedSheet.getRange("F:F").getFormat().setColumnWidth(114);
  // Set width of column(s) at range G:G on selectedSheet to 93
  selectedSheet.getRange("G:G").getFormat().setColumnWidth(93);
  // Set width of column(s) at range H:H on selectedSheet to 54
  selectedSheet.getRange("H:H").getFormat().setColumnWidth(54);
  // Set width of column(s) at range I:I on selectedSheet to 112.5
  selectedSheet.getRange("I:I").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("J:J").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("K:K").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("L:L").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("M:M").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("N:N").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("O:O").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("P:P").getFormat().setColumnWidth(120.5);
  selectedSheet.getRange("Q:Q").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("R:R").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("S:S").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("T:T").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("U:U").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("V:V").getFormat().setColumnWidth(112.5);
  selectedSheet.getRange("W:W").getFormat().setColumnWidth(120.5);
  selectedSheet.getRange("X:X").getFormat().setColumnWidth(120.5);
  selectedSheet.getRange("Y:Y").getFormat().setColumnWidth(120.5);
  selectedSheet.getRange("Z:Z").getFormat().setColumnWidth(120.5);
  // Add a new table at range A1:I1 on selectedSheet
  workbook.addTable(selectedSheet.getRange("A1:I" + counter), true).setName("ContactInfo");
}
 
 
DID ANY ONE KNOW HOW TO OVERCOME THESE ERROR
Categories:
I have the same question (0)
  • Vijaysai Profile Picture
    10 on at

    @Expiscornovus   my power autometa flow is convert csv to xlsx

    Vijaysai_0-1684136007386.png

    1.after GSV(Run a flow against a quer) create csv table is used to convert data in to csv 

    2.create file2: it will create csv file in one of the sharepoint path .

     

    3.get file content is used to read the csv data 

    4.create file is used create the xlsx file in same path or diffrent of csv file in create file i was given .xlsx at the end of file name 

    5.xlsx file was created in sharepoint but the problem is it was not opened while opening getting an error like unable to open file .

    6. after watching youtube video i will try the flow but getting error in excel file code 

    Vijaysai_1-1684136346752.png

    how can i convert csv file in to xlsx in simple way 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 550

#2
Valantis Profile Picture

Valantis 390

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard