using System;
using Excel = Microsoft.Office.Interop.Excel;
namespace ExcelVirgulNoktaDegistirme
{
class Program
{
static void Main(string[] args)
{
string excelFilePath = "C:\\path\\to\\your\\excel-file.xlsx";
int targetColumnIndex = 2; // Örnek olarak ikinci sütunu ele alıyoruz (0 tabanlı indeksleme).
Excel.Application excelApp = new Excel.Application();
Excel.Workbook workbook = excelApp.Workbooks.Open(excelFilePath);
Excel.Worksheet worksheet = workbook.Sheets[1]; // İşlem yapmak istediğiniz sayfayı seçin.
Excel.Range usedRange = worksheet.UsedRange;
Excel.Range targetColumn = usedRange.Columns[targetColumnIndex + 1]; // Sütun indeksini 1 artırarak ayarlayın.
foreach (Excel.Range cell in targetColumn.Cells)
{
string cellValue = cell.Value?.ToString();
if (!string.IsNullOrEmpty(cellValue))
{
string newValue = cellValue.Replace(",", ".");
cell.Value = newValue;
}
}
workbook.Save();
workbook.Close();
excelApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook);
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);
Console.WriteLine("İşlem tamamlandı.");
}
}
}