getCsv method return data contains data format

Posted by: zhoubing.yang on 12 May 2022, 4:40 am EST

  • Posted 12 May 2022, 4:40 am EST

    Is there a way to return all data with plain format when using getCsv method?

    Currently, when my spreadsheet contained formatted number data such as “12,000” (number with thousandsep), getCsv return “12,000” instead of “12000”

  • Posted 15 May 2022, 9:28 pm EST

    Hi,

    We are sorry but getCSV data only return the inside value, not the formatted text. You may create your own function to get all the text with format from a particular range. Please refer to the following code snippet and attached sample that explains the same.

    
    function getALLText(sheet, range) {
      if (!(range instanceof GC.Spread.Sheets.CellRange)) return null;
      let data = [],
        rowData = [];
      for (let row = range.row; row < range.row + range.rowCount; row++) {
        rowData = [];
        for (let col = range.col; col < range.col + range.colCount; col++) {
          rowData.push(sheet.getText(row, col));
        }
        data.push(rowData);
      }
      return data;
    }
    
    

    sample: https://codesandbox.io/s/spread-js-starter-forked-nwjcvh?file=/src/index.js:573-997

    regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels