Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: CF10 and Spreadsheets changed from CF9 !!

$
0
0

Hi Anit,

Thanks for the reply.

 

I sure can

 

<cfscript>

sheetsToKeep = '1'; // sheet number to keep

theFile = thePath & "\myXLSX.xlsx"; // path to the xlsx file

spreadsheet = SpreadSheetRead(theFile); // read the spreadsheet

sheetsToDelete = ""; // var to hold the sheet that need to be deleted

// loop through the sheets in the spreadsheet

for(x=1; x<=spreadsheet.SummaryInfo.Sheets; x++){

if(listContains(sheetsToKeep, x) eq 0){

  // build a list of sheets to delete

  sheetsToDelete = listAppend(sheetsToDelete, listgetAt(spreadsheet.SummaryInfo.SheetNames, x));

}

}

// loop through the sheets to delete and delete them

for(s=1; s<=listLen(sheetsToDelete); s++){

SpreadsheetSetActiveSheet (spreadsheet, listGetAt(sheetsToDelete, s));

spreadsheetRemoveSheet(spreadsheet, listGetAt(sheetsToDelete, s));

}

//save the spreadsheet

SpreadSheetWrite(spreadsheet, theFile, "yes");

</cfscript>

 

The above code works in CF9, but I get the follwoing error in CF10

 

An exception occurred while using action=write

java.lang.NullPointerException

 

 

I should also state that if I save the xlsx as xls in ms excel and then use the same code it works.

I have also tried the read and save and removed all the code inbetween and still get the error.

Regards

Ken Caldwell


Viewing all articles
Browse latest Browse all 21760


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>