Hi,
New to Aspose.cells I just discovered that cell = ws.Cells[adcell] cause “invalid cell name” error if adcell contains $ (like $B$24). To me this well known notation excel compatible should not cause an error. Am I wrong ?
Thanks
Olivier
Hi,
New to Aspose.cells I just discovered that cell = ws.Cells[adcell] cause “invalid cell name” error if adcell contains $ (like $B$24). To me this well known notation excel compatible should not cause an error. Am I wrong ?
Thanks
Olivier
Yes, you need not to use “$” when using cell names, so you will use “B24” instead of “$B$24”. See the following two ways to get specific worksheet cell.
e.g.
Sample code:
//Load an Excel file
Workbook workbook = new Workbook("Book1.xlsx");
//Get first worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Get the worksheet cells
Cells cells = worksheet.Cells;
//Get the "B24" cell
string adcell = "B24";
Cell cell = cells[adcell];
//Or
//Cell cell = cells[23, 1];
Also, see the document with examples on how to access cells in the worksheet for your reference.
https://docs.aspose.com/cells/net/accessing-cells-of-a-worksheet/
Thanks for your answer, so I’ll remove the $ signs, I’m a bit surprised, not understanding why it causes a problem. Never mind !
Best regards.
Olivier
You are welcome. If you have further queries or issue, please feel free to write us back.