Forum Discussion
aflesner
Apr 29, 2023Copper Contributor
Convert CSV to Excel Office Script
I created the convert csv to excel office script from the template. I used it in power automate to convert all csv files in a folder to excel. It worked great until today now I am receiving and error...
SergeiBaklan
May 03, 2023Diamond Contributor
It doesn't work in Automate
See line 30, column 13: Office Scripts cannot infer the data type of this variable. Please declare a type for the variable.
perhaps works in ScriptLab.
But in general, does that solve an issue when csv is not forwarded to the script?
peiyezhu
May 03, 2023Bronze Contributor
// Create a 2D array with one row. change back
let data: string[][] = [];
Because I tested it in native js environment rather than type script, so I use let data=[] without type declare.
if possible,use that in your codes as above.
what I mean change the regular expression which can parse directly without additional codes to check like below
// Check for blanks at the start of the row.
if (row[0].charAt(0) === ',') {
row.unshift("");
}
let data: string[][] = [];
Because I tested it in native js environment rather than type script, so I use let data=[] without type declare.
if possible,use that in your codes as above.
what I mean change the regular expression which can parse directly without additional codes to check like below
// Check for blanks at the start of the row.
if (row[0].charAt(0) === ',') {
row.unshift("");
}
- LorenzoMay 10, 2023Silver Contributor
What a shame...
- SergeiBaklanMay 10, 2023Diamond Contributor
Lorenzo , I've seen nothing more.
- peiyezhuMay 09, 2023Bronze ContributorYes,I think so.
- SergeiBaklanMay 08, 2023Diamond Contributor
Oh, yes, your javascript/truescript professionalism is very appreciated, it helps to adjust existing ExcelScript. To play with the flow we need to reproduce it in our environment with data used, not enough input for that.
- peiyezhuMay 04, 2023Bronze ContributorSure, that is true. I have no environment to have trouble shooting on the Power Automate flow question from the open thread.
Just a small talk on relative codes -:) - SergeiBaklanMay 04, 2023Diamond Contributor
That's okay, but that doesn't answer on question why we don't have csv input from Power Automate flow.