How do i make a cell using variables? using VB script in Excel 2007 - vbscript

I am working on a project which requires me check for the last used row in the spreadsheet and then extract data from a range of cells from another spreadsheet after this last used row in a cell (i.e. A10 etc.)
The problem is that i know which column name from the current spreadsheet to use for importing data (i.e column A), but is there a way to assign the row number and make a cell which looks like "A". The last used keeps changing as the last row used keeps changing as we add data.
Here is the current code to maybe better explain myself:
LastRow = Cells.SpecialCells(xlCellTypeLastCell).Row
CurrRow = LastRow + 1
ExtractExcelToArray wsDCCTabA.Range("C15:C25") ' Extracting from here
ExportAccesstoExcel wsTempGtoS.Range("E&CurrRow:E12") 'importing into current spreadsheet code here
As you can see, i tried using something like "E&CurrRow" but it doesnt seem to work. Any help is appreciated.

ExportAccesstoExcel wsTempGtoS.Range("E" & CurrRow & ":E12")

Related

how to read 1 excel file with multiple sheet

I need to get specific value from data table 1 sheet1, sheet2, sheet3, sheet4 and write it to specific cell in my data table 2.
what approach I should do.
I want it to be dynamic.
Please do provide more specific. I am assuming you need to read all the sheets in an excel file and act to that data. For read all the sheets in an Excel file (.xlsx) I used the following:
Then I iterated through the sheet names to read each sheet
Hope this helps for the first part of your question!

How to declare cell range only with occupied range in excel

I am working on an Excel based C# project where I have to put a whole column of data into a single dimensional array but I am unable to find proper way to do so.
The code I have used is although working but it drops the whole data of a column including unused cells (after the used range of my Excel column) into an array which wastes system resources.
any idea how to achieve this . I have tried the below code .
Excel.Range range3 = sheet.get_Range("A:A");
You'll need to infer the code prior to get the workbook and worksheet but try this ...
var lastCell = (Range)xlWorksheet.Range[$"A{xlWorksheet.Rows.Count}"].End[XlDirection.xlUp];
var values = ((Range)xlWorksheet.Range[$"A1:{lastCell.Address}"]).Value;
It will find the last visible cell in column A and then provide all of the values from A1 down to the last cell into an array.

sheet Map 0 have no Rows in excelize

Helo everyone need your help.
I had one file that I get from daily report download with xlsx extension.
Then I want to insert to MongoDB for analytic cause per day can be 100K rows, and I use golang with excelize to extract excel data then insert them to mongoDB, there is the problem :
When I GetRows("Sheet 1") the result is 0 and when I check the sheet with GetSeetMap() result is [0:Sheet 1] and it is still 0 rows.
But when I renamed sheet name (ie: rename to another Sheet) and I check the sheet map it change to [1:another Sheet] and rows detected when the sheet map key is 1, how to fix this?
Thanks for advance
Are you sure it shouldn't be "Sheet1" (i.e. without a space)?

Insert a new Google Sheets row into Alphabetically Sorted spreadsheet

I am working with two spreadsheets; the first spreadsheet takes a name and then automatically adds it to the next spreadsheet which is sorted alphabetically by name. The problem is, I need a new row to be created, otherwise the data from the row above it gets added along with the name. Here is the query I am using: '=query(Referrals!A2:O, "select * where C is not null order by D")'. I don't think this can be done with a query, so I have been exploring Google App Scripts. I am not sure how to insert into the pre-sorted list, though. Any help is greatly appreciated!
Have you tried offsetting the header so you can run it for the range of the sheet?
=query(Referrals!A:O, "select * where C is not null order by D Offset 1")
That seems to fix some of the issues I've come across.
EDIT:
What about using a filter formula?
=sort(FILTER(offset(Referrals!$A:$O,1,0),offset(Referrals!$C:$C,1,0)<>""),4,true)
If using Apps Script, then you can directly insert a row (via Sheet.insertRows(rowIndex, numRows)) into the sheet at the desired index. But I believe you can achieve what you want by mapping the data in "next spreadsheet" to the names imported via "query" using VLOOKUP. That way when new data is added to "first spreadsheet" it will be sorted accordingly with your formula, but now the data associated will move rows to continue matching their respective row.

Ruby spreadsheet : getting column count in xls file

Is there any way to count the number of columns in a spreadsheet file using ruby? I am using the latest version of spreadsheet gem.
It looks like there are a number of possible solutions based on your needs and situation:
book = Spreadsheet.open('/path/to/an/excel-file.xls')
sheet1 = book.worksheet(0)
# get the number of columns in the first row
sheet1.row(0).size
# get the maximum number of columns in all the rows
sheet1.rows.max_by(&:size)
# use the dimension logic from the gem. It looks like this ignores empty columns at the beginning of the sheet
sheet1.column_count
column_count source:
https://github.com/zdavatz/spreadsheet/blob/master/lib/spreadsheet/worksheet.rb#L96-L99
Let us know what works for you and what you find out by playing with it.

Resources