Jump to content

Write a single row from an array to excel?


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...