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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert CSV files to E...
Power Automate
Unanswered

Convert CSV files to Excel workbooks - Office Scripts not working?

(0) ShareShare
ReportReport
Posted on by 2

I have been using Convert CSV files to Excel workbooks - Office Scripts | Microsoft Docs  tutorial to convert a csv to excel data in sharepoint. I have also tried in onedrive. My limiter seems to be in Office Scripts since I can't seem to make it beyond csv = csv.replace(/\r/g, "");

 

function main(workbook: ExcelScript.Workbook, csv: string) {
 
 let sheet = workbook.getWorksheet("Sheet1");

 // Remove any Windows \r characters.
 csv = csv.replace(/\r/g, "");

 // Split each line into a row.
 let rows = csv.split("\n");
 /*

 

 

I get the error  

Line 9: Cannot read properties of undefined (reading 'replace')

 

 

Categories:
I have the same question (0)
  • Bubulover Profile Picture
    32 on at

    Hi,

     

    I previously used the below video and it works for me.

     

    Convert CSV Files to Excel (xslx format) in Power Automate - Bing video

     

    Hoping it helps.

  • Yutao Huang Profile Picture
    Microsoft Employee on at

    Based on the error message, it feels to me the script input parameter "csv" is probably missing. Can you share a bit more about your flow? Where did you get the source CSV content? Did you pass this CSV content to the "Run script" action as a parameter for "csv"?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2025 Season 2

#2
Expiscornovus Profile Picture

Expiscornovus 211 Most Valuable Professional

#3
trice602 Profile Picture

trice602 198 Super User 2025 Season 2

Last 30 days Overall leaderboard