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')