Cannot convert Array to Odject[][] Even though it is a 2D array

时间:2016-02-12 20:18:27

标签: arrays google-apps-script google-sheets

Still new and just learning how to use arrays. I am getting the error "Cannot convert Array to Object[][]. (line 46, file "Submit to Record")

Line 46 is

$result_sql = mssql_query($sql);

I had this error once before, but it was because of an array inside an array issue. Now I don't know what's wrong.

The entire code is

  targetSheet.getRange(lastRow+1, 1, 1, arrayOfData.length).setValues(arrayOfData);

I know this code is clunky and could be written more efficiently and condensed, but I am writing this way on purpose because I am new to JS and this is an easy way for me to keep my head on straight about what is happening in the code. I hope my sanity efforts are not the cause of my problem. Please help. :)

1 个答案:

答案 0 :(得分:1)

Serge insas answered the question in the comments. He said:

I guess you should simply write

Rx

but I'm just guessing ;-)"

That did indeed fix the problem. Thanks, Serge insas!

相关问题