【发布时间】:2022-04-05 18:34:25
【问题描述】:
作为 ETL 过程的一部分,我将数据从各种不同的 Excel 文件导入数据库。在此之前,我需要能够将 Excel 工作表中所有单元格的单元格格式更改为“常规”格式。
我已经开始了,但我担心之后我不知道如何进步:
using Excel = Microsoft.Office.Interop.Excel;
.
.
.
String FilePath = "Code to get file location from database"
String SheetName = "Code to get SheetName from database"
Excel.Application MyApp = new Excel.Application();
MyApp.Visible = false;
Excel.Workbook myWorkbook = MyApp.Workbooks.Open(FilePath,Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing);
//Code here to convert all rows to data type of general and then save
MyApp.Workbooks.Close();
对此的任何帮助将不胜感激
【问题讨论】: