We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

convert excel to csv using XlsIO

hi,

i have a mapping excel file containing external links to other ratesheet files (could be 1 ratesheet file or multiple ratesheet files). The mapping excel may have pivot table in other workbook.
When i open the ratesheet files and mapping file. The mapping files will refresh and pickup new data from ratesheet files.
and then save the mapping excel file to csv file.

Is there a way to accomplish that? I tried, but it does not work.
           
            string rsFile = @"C:\Rates.xls";
            string wsFile = @"C:\Worksheet Franklin.xls";

 ExcelEngine excelEngine = new ExcelEngine();
            
            IWorkbook rs = excelEngine.Excel.Workbooks.Open(@rsFile, ExcelOpenType.Automatic);

            IWorkbook ws = excelEngine.Excel.Workbooks.Open(@wsFile, ExcelOpenType.Automatic);

            ws.ActiveSheetIndex = 0;

            ws.SaveAs(@wsFile.Replace(".xls", ".csv").Replace(".xlsx", ".csv"));

Thanks,
Minh


3 Replies

IN Ishwarya Narayanan Syncfusion Team January 8, 2015 01:26 PM UTC

Hi Minhnj,

 

Thank you for using Syncfusion products.

We have analyzed your query and found that “comma(,) separator argument is missing in your save method.” We have shared the code snippet and sample for your reference. Kindly try the sample at your end and get back to us if the issue is reproducing. If not, please modify the sample to reproduce the issue and get back to us. This will help us to investigate further and provide you a prompt solution. 

Code Snippet:

 

workbook2.SaveAs(inputPath2.Replace(".xls", ".csv").Replace(".xlsx", ".csv"),",");

 

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/Forum1179102133420831.zip

 

Refers,

Ishwarya N



MI minhnj January 8, 2015 03:17 PM UTC

hi Ishwarya,

I have it works to saveas csv file, however, it does not update with new data from my mapping file. my mapping file has pivot table in other worksheet. How do i update the external link or refresh the whole workbook to get updated data from ratesheet files?

I want to post my ratesheet file in private, not display to people. Is there an option for it? because i am concerning about the security risk.

Thanks
Minh


IN Ishwarya Narayanan Syncfusion Team January 9, 2015 07:35 AM UTC

Hi Minhnj,

 

We appreciate your patience.

 

It would be grateful for us to investigate on this if you could share us the input template to proceed further on this. We would request you to use our Direct-Trac Support system for further follow up.

Kindly use the below link to login on Direct trac.

 

Direct trac Link:  https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

 

Please let us know if you need any clarification.

 

Regards,

Ishwarya N


Loader.
Up arrow icon