Forum Discussion
If you are using rowCount for output row number then
rowCount = 1 should do it for you. From there you can keep incrementing it.
In case that is not true, please paste some code where you are writing the values to Excel.
I tried to fix the value like 'rowCount = 1'.
And then the result is written at that just one time.
After that 2rd result is written same position the 1th result is gone.
I want to writ the 1th result from 1 position and 2rd result must be written the bottom.
- djadhav9 years agoRegular Contributor
I agree, that's what would happen. We need to use it this way
rowCount = 1
- Begin writing to excel
Get value of rowCount
Write to excel
increment value of rowCount
- End writing to Excel
Loop from - Begin to - End as many times as required
If you post some of your code then it'll be easier.
- hskim9 years agoContributor
Over here this is my code
I want to write the result(data) 'rowCount=2' and then new result must be written the bottom.
The new result(data) will be gotten twice a minute.
---------------------------------------
function WriteExcelSheet(fname, sheetName)
{
var maxcol = 1, maxrow = 1;
var app = Sys.OleObject("Excel.Application");
var book = app.Workbooks.Open(fname);
var sheet = book.Sheets(sheetName);
// app.DisplayAlerts = false;
//-------------------------------
var TimeValue, NowValue, StringTimeValue, StringNowValue, VariantTimeValue, VariantNowValue;
TimeValue=aqDateTime.Time();NowValue=aqDateTime.Now();
StringTimeValue = aqConvert.DateTimeToStr(TimeValue);
StringNowValue = aqConvert.DateTimeToStr(NowValue);
var rowCount = getRowCount(sheet);
// var rowCount = 2;
sheet.Cells(rowCount+1, 7) = StringNowValue;
sheet.Cells(rowCount+1, 1) = Project.Variables.ChID001;
sheet.Cells(rowCount+2, 1) = Project.Variables.ChID002;
sheet.Cells(rowCount+3, 1) = Project.Variables.ChID003;
sheet.Cells(rowCount+4, 1) = Project.Variables.ChID004;
sheet.Cells(rowCount+5, 1) = Project.Variables.ChID005;
sheet.Cells(rowCount+6, 1) = Project.Variables.ChID006;
sheet.Cells(rowCount+7, 1) = Project.Variables.ChID007;
sheet.Cells(rowCount+8, 1) = Project.Variables.ChID008;
sheet.Cells(rowCount+9, 1) = Project.Variables.ChID009;
sheet.Cells(rowCount+10, 1) = Project.Variables.ChID010;
sheet.Cells(rowCount+11, 1) = Project.Variables.ChID011;
sheet.Cells(rowCount+12, 1) = Project.Variables.ChID012;
sheet.Cells(rowCount+13, 1) = Project.Variables.ChID013;
sheet.Cells(rowCount+14, 1) = Project.Variables.ChID014;
sheet.Cells(rowCount+15, 1) = Project.Variables.ChID015;
sheet.Cells(rowCount+16, 1) = Project.Variables.ChID016;
// var rowCountb = sheet.UsedRange.Rows.Count+1;
// for(var rowb = rowCountb; rowb < rowCountb + 1; rowb++)
sheet.Cells(rowCount+1, 3) = Project.Variables.Value001;
sheet.Cells(rowCount+2, 3) = Project.Variables.Value002;
sheet.Cells(rowCount+3, 3) = Project.Variables.Value003;
sheet.Cells(rowCount+4, 3) = Project.Variables.Value004;
sheet.Cells(rowCount+5, 3) = Project.Variables.Value005;
sheet.Cells(rowCount+6, 3) = Project.Variables.Value006;
sheet.Cells(rowCount+7, 3) = Project.Variables.Value007;
sheet.Cells(rowCount+8, 3) = Project.Variables.Value008;
sheet.Cells(rowCount+9, 3) = Project.Variables.Value009;
sheet.Cells(rowCount+10, 3) = Project.Variables.Value010;
sheet.Cells(rowCount+11, 3) = Project.Variables.Value011;
sheet.Cells(rowCount+12, 3) = Project.Variables.Value012;
sheet.Cells(rowCount+13, 3) = Project.Variables.Value013;
sheet.Cells(rowCount+14, 3) = Project.Variables.Value014;
sheet.Cells(rowCount+15, 3) = Project.Variables.Value015;
sheet.Cells(rowCount+16, 3) = Project.Variables.Value016;
book.Save();
app.Quit();
}- djadhav9 years agoRegular Contributor
What is this function doing getRowCount(sheet)?
From the above code, what output are you getting? Attach screenshots
Related Content
Recent Discussions
- 22 hours agodhundley