UNPKG

danfojs

Version:

JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.

59 lines (57 loc) 2.3 kB
/** * @license * Copyright 2022 JsData. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================================== */ import { ExcelOutputOptionsBrowser, ExcelInputOptionsBrowser } from "../../shared/types"; import { DataFrame, NDframe, Series } from '../../'; /** * Reads a JSON file from local or remote location into a DataFrame. * @param file URL or local file path to JSON file. * @param options Configuration object. Supported options: * - `method`: The HTTP method to use. Defaults to `'GET'`. * - `headers`: Additional headers to send with the request. Supports the `node-fetch` [HeadersInit] * @example * ``` * import { readExcel } from "danfojs-node" * const df = await readExcel("https://raw.githubusercontent.com/test.xlsx") * ``` * @example * ``` * import { readExcel } from "danfojs-node" * const df = await readExcel("https://raw.githubusercontent.com/test.xlsx", { * method: "GET", * headers: { * Accept: "text/csv", * Authorization: "Bearer YWRtaW46YWRtaW4=" * } * }) * ``` */ declare const $readExcel: (file: any, options?: ExcelInputOptionsBrowser | undefined) => Promise<unknown>; /** * Converts a DataFrame or Series to Excel Sheet. * @param df DataFrame or Series to be converted to JSON. * @param options Configuration object. Supported options: * - `sheetName`: The sheet name to be written to. Defaults to `'Sheet1'`. * - `fileName`: The file to be written to. Defaults to `'./output.xlsx'`. * @example * ``` * import { toExcel } from "danfojs-node" * const df = new DataFrame([[1, 2, 3], [4, 5, 6]]) * toExcel(df, { * fileName: "./data/sample.xlsx", * sheetName: "MySheet", * }) * ``` */ declare const $toExcel: (df: NDframe | DataFrame | Series, options?: ExcelOutputOptionsBrowser | undefined) => void; export { $readExcel, $toExcel };