Sign in to follow this  
Followers 0
jando123

Write a single row from an array to excel?

3 posts in this topic

#1 ·  Posted (edited)

Hello,

This seems like a newb question. I have a 2D array of data and I want to be able to write a particular row of that array into an Excel doc.

I tried to do it using _ExcelWriteSheetfromArray but this copies the whole 2D array and the parameters for the function doesn't help.

I thought maybe if I place in the row # that I need ex: _ExcelWriteSheetfromArray($oExcel, $Array[4]) it would help but I get a dimension error.

_ExcelWriteArray seems to only work on 1D arrays. What to do?

Thanks

Edited by jando123

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You could always just write the cells individually since you're only wanting one particular row.

Local $tmp[1][2]

$tmp[0][0] = '1x1'
$tmp[0][1] = '1x2'

$oExcel = _ExcelBookNew()

_ExcelWriteCell($oExcel, $tmp[0][0], 1, 1)
_ExcelWriteCell($oExcel, $tmp[0][1], 1, 2)
Edited by zpanderson

Share this post


Link to post
Share on other sites

Redim your array to have one dimension and write it to the sheet.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0